Created
July 29, 2014 22:00
-
-
Save agconti/b1ff0745aa83740b0f8d to your computer and use it in GitHub Desktop.
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
/* Put your CSS here */ | |
html, body { | |
margin: 20px; | |
} |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<title>Ember Starter Kit</title> | |
<link rel="stylesheet" href="http://cdnjs.cloudflare.com/ajax/libs/normalize/2.1.0/normalize.css"> | |
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script> | |
<script src="http://builds.handlebarsjs.com.s3.amazonaws.com/handlebars-v1.3.0.js"></script> | |
<script src="http://builds.emberjs.com/tags/v1.6.1/ember.js"></script> | |
<script type="text/javascript" src="http://cdnjs.cloudflare.com/ajax/libs/ember-data.js/1.0.0-beta.8/ember-data.min.js"></script> | |
</head> | |
<body> | |
<script type="text/x-handlebars" data-template-name="application"> | |
<h2> Welcome to Ember.js</h2> | |
{{outlet}} | |
</script> | |
<script type="text/x-handlebars" data-template-name="index"> | |
<p>Wanna see some cool {{#link-to "colors"}}colors?{{/link-to}}</p> | |
<ul> | |
{{#each item in model}} | |
<li>{{item.color}}</li> | |
{{/each}} | |
</ul> | |
</script> | |
<script type="text/x-handlebars" data-template-name="colors"> | |
<h1>The Colors LUKE!</h1> | |
{{outlet}} | |
</script> | |
<script type="text/x-handlebars" data-template-name="colors/index"> | |
<ul> | |
{{#each item in model}} | |
<li>{{#link-to "color" this}}{{item.color}}{{/link-to}}</li> | |
{{/each}} | |
</ul> | |
</script> | |
<script type="text/x-handlebars" data-template-name="color"> | |
<h1>Lots more info about {{model.color}}</h1> | |
{{#each item in model}} | |
{{ item.color }} | |
{{/each}} | |
</script> | |
</body> | |
</html> |
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
App = Ember.Application.create({ | |
LOG_TRANSITIONS: true | |
}); | |
App.ApplicationAdapter = DS.FixtureAdapter.extend(); | |
App.Color = DS.Model.extend({ | |
color: DS.attr( 'string' ) | |
}); | |
App.Color.FIXTURES = [ | |
{id: 1, color:"red"}, | |
{id: 2, color:"yellow"}, | |
{id: 3, color:"blue"}, | |
]; | |
App.Router.map(function() { | |
this.resource("colors", function(){ | |
this.resource("color", {path: "/:colors_id"}); | |
}); | |
}); | |
App.IndexRoute = Ember.Route.extend({ | |
model: function() { | |
return this.store.findAll('color'); | |
} | |
}); | |
App.ColorsRoute = Ember.Route.extend({ | |
model: function() { | |
return this.store.findAll('color'); | |
} | |
}); | |
App.ColorRoute = Ember.Route.extend({ | |
model: function(params) { | |
console.log(params); | |
return this.store.findBy("color", params.colors_id); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment