Ember Latest
The latest build of Ember.
by Abdull
HTML
<script src="http://builds.emberjs.com/handlebars-1.0.0.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/ember.js/1.3.1/ember.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/ember-data.js/1.0.0-beta.6/ember-data.js"></script>
<script type="text/x-handlebars" data-template-name="application">
<h1>ember - defaultValue test</h1>
<ul>
<li>{{#link-to "normal"}}Go to NormalRoute{{/link-to}}</li>
</ul>
{{outlet}}
</script>
<script type="text/x-handlebars" data-template-name="index">
Select a route
</script>
<script type="text/x-handlebars" data-template-name="normal">
<h2>Normal Route: {{message}}</h2>
<h2>Root message: {{rootMessage}}</h2>
<ul>
{{#each}}
<li>{{description}}</li>
<li>thisShouldBeFalse: {{thisShouldBeFalse}}</li>
<li>thisShouldBeTrue: {{thisShouldBeTrue}}</li>
{{/each}}
</ul>
</script>
JavaScript
App = Ember.Application.create({});
Ember.Inflector.inflector.irregular('facebookPage', 'fbpages');
App.ApplicationAdapter = DS.RESTAdapter.extend({
namespace: "api",
host: "http://www.geeshenk.com"
});
App.FacebookPage = DS.Model.extend({
username: DS.attr("string"),
name: DS.attr("string"),
pictureUrl: function() {
return "http://graph.facebook.com/" + this.get("id")
+ "/picture?type=large";
}.property("id"),
smallPictureUrl: function() {
return "http://graph.facebook.com/" + this.get("id")
+ "/picture?type=square";
}.property("id"),
presentIdeas: DS.hasMany("product"),
//presentIdeas: DS.hasMany("product", {async: "true"}),
//shouldLookForOneMorePresentIdea: true,
shouldLookForOneMorePresentIdea: DS.attr("boolean", {defaultValue: true}),
hasBeenTriggered: DS.attr("boolean", {defaultValue: false}),
isWaitingForFirstPresent: DS.attr("boolean", {defaultValue: false}),
currentPresentIndex: DS.attr("number", {defaultValue: 0})
});
App.Router.map(function () {
this.resource("normal");
});
App.NormalRoute = Ember.Route.extend({
model: function () {
return this.store.find("facebookPage");
}
});
App.NormalController = Ember.ObjectController.extend({
rootMessage: "This is a message from NormalController",
message: "This is NormalController",
init: function() {
console.log("initializing NormalController");
},
}); //NormalController