api de gestion de ticket, basé sur php-crud-api. Le but est de décorrélé les outils de gestion des données, afin
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

client_angular2.html 1.1KB

1234567891011121314151617181920212223242526272829303132
  1. <html>
  2. <head>
  3. <script src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/2.0.0-beta.14/angular2-polyfills.min.js"></script>
  4. <script src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/2.0.0-beta.14/Rx.umd.min.js"></script>
  5. <script src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/2.0.0-beta.14/angular2-all.umd.min.js"></script>
  6. <script src="../lib/php_crud_api_transform.js"></script>
  7. <script>
  8. AppComponent =
  9. ng.core.Component({
  10. selector: 'my-app',
  11. providers: [ng.http.HTTP_PROVIDERS],
  12. template: '<ul><li *ngFor="#x of posts">{{ x.id + ", " + x.content }}</li></ul>'
  13. })
  14. .Class({
  15. constructor: [
  16. ng.http.Http, function(http) {
  17. var url = "../api.php/posts";
  18. http.post(url,JSON.stringify({user_id:1,category_id:1,content:"from angular2"})).subscribe();
  19. http.get(url).map(res => php_crud_api_transform(res.json())).subscribe(res => this.posts = res.posts);
  20. }
  21. ]
  22. });
  23. document.addEventListener("DOMContentLoaded", function(event) {
  24. ng.core.enableProdMode();
  25. ng.platform.browser.bootstrap(AppComponent);
  26. });
  27. </script>
  28. </head>
  29. <body>
  30. <my-app>Loading...</my-app>
  31. </body>
  32. </html>