Advertisement
Guest User

Ember

a guest
Apr 6th, 2013
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. App = Ember.Application.create();
  2.  
  3. //Data store
  4. App.Store = DS.Store.extend({
  5.     revision:12,
  6.     adapter:DS.RESTAdapter.extend({
  7.         url:"http://localhost/book-store-restful-api/api"
  8.     })
  9. });
  10. //routers
  11. App.Router.map(function(){
  12.     this.resource('book');
  13.     this.resource('admin');
  14. });
  15.  
  16.  
  17. App.BookRoute = Ember.Route.extend({
  18.     model: function(){
  19.         return App.Book.find();
  20.     }
  21. });
  22.  
  23. App.IndexRoute = Ember.Route.extend({
  24.     redirect: function(){
  25.         this.transitionTo('book');
  26.     }
  27. });
  28.  
  29. App.Book = DS.Model.extend({
  30.     isbn: DS.attr('string'),
  31.     title: DS.attr('string'),
  32.     author: DS.attr('string'),
  33.     pub: DS.attr('string'),
  34.     year: DS.attr('string'),
  35.     price: DS.attr('string')
  36. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement