-
Notifications
You must be signed in to change notification settings - Fork 1
502 Super Power Model Collection
zarlex edited this page Mar 6, 2017
·
1 revision
For the endpoint super-powers
we create a model and a collection to work with the data form the endpoint.
Create the file super-power.model.js
in hero/models
angular.module('mwPortal.Main')
.service('SuperPowerModel', function (MwPortalModel) {
return MwPortalModel.extend({
endpoint: '/super-powers'
});
});
Create the file super-powers.colelction.js
in hero/collections
angular.module('mwPortal.Main')
.service('SuperPowersCollection', function (MwPortalCollection, SuperPowerModel) {
return MwPortalCollection.extend({
endpoint: '/super-powers',
model: SuperPowerModel
});
});
Include the created files in your index.html
...
<!-- Hero module -->
<script src="app/modules/hero/models/super-power.model.js"></script>
<script src="app/modules/hero/collections/super-powers.collection.js"></script>
...