Last active
December 16, 2015 17:59
-
-
Save ericeijkelenboom/5474261 to your computer and use it in GitHub Desktop.
Presentation: building a Single Page App
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <table class="table table-hover"> | |
| <thead> | |
| <tr> | |
| <th>Campaign name</th> | |
| <th>Number of points before redeem</th> | |
| </tr> | |
| </thead> | |
| <tbody data-bind="foreach: campaigns"> | |
| <tr> | |
| <td data-bind="text: description, click: $parent.showDetails"></td> | |
| <td data-bind="text: numberOfPointsBeforeRedeem"></td> | |
| </tr> | |
| </tbody> | |
| </table> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <form> | |
| <label>Description</label> | |
| <input type="text" data-bind="value: description"/> | |
| <label>Number of points before redeem</label> | |
| <input data-bind="value: numberOfPointsBeforeRedeem" type="text" /> | |
| <br/> | |
| <button class="btn btn-primary" type="submit" data-bind="click: $parent.save">Save</button> | |
| <button class="btn" type="submit" data-bind="click: $parent.cancel">Cancel</button> | |
| </form> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| if (forceRemote) | |
| query = query.using(breeze.FetchStrategy.FromServer); | |
| else | |
| query = query.using(breeze.FetchStrategy.FromLocalCache); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function getCampaigns() { | |
| var query = breeze.EntityQuery.from('Campaigns').orderBy('description'); | |
| return mgr.executeQuery(query); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function getCampaignById(id) { | |
| return mgr.fetchEntityByKey('Campaign', id, true); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function init() { | |
| return mgr.fetchMetadata(); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function showDetails(campaign) { | |
| router.navigateTo('#details/' + campaign.id()); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| breeze.NamingConvention.camelCase.setAsDefault(); | |
| var mgr = new breeze.EntityManager('http://qrcampaign.azurewebsites.net/api/subscriptions'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment