Last active
December 14, 2015 12:38
-
-
Save mjallday/5087204 to your computer and use it in GitHub Desktop.
Ember.js teething issues
This file contains 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 lang="en"> | |
<head> | |
<meta charset="utf-8"> | |
<title>My HTML File</title> | |
<link rel="stylesheet" | |
href="http://twitter.github.com/bootstrap/assets/css/bootstrap.css"> | |
<script src="http://code.jquery.com/jquery-1.9.1.min.js"></script> | |
<script src="https://raw.github.com/wycats/handlebars.js/1.0.0-rc.3/dist/handlebars.js"></script> | |
<script src="https://raw.github.com/emberjs/ember.js/release-builds/ember-1.0.0-rc.1.js"></script> | |
</head> | |
<body> | |
<script type="text/x-handlebars" data-template-name="application"> | |
<h1>Ember Committers</h1> | |
<nav> | |
{{#linkTo "index"}}Index{{/linkTo}} | |
{{#linkTo "about"}}About{{/linkTo}} | |
{{#linkTo "invoices"}}Invoices{{/linkTo}} | |
</nav> | |
{{ outlet }} | |
</script> | |
<script type="text/x-handlebars" data-template-name="invoices"> | |
<h1>Invoices</h1> | |
</script> | |
<script type="text/x-handlebars" data-template-name="invoices/index"> | |
<ul> | |
{{#each invoice in invoices }} | |
<li>{{#linkTo "show" invoice.id}}{{ invoice.id }}{{/linkTo }}</li> | |
{{/each }} | |
</ul> | |
</script> | |
<script type="text/x-handlebars" data-template-name="invoices/show"> | |
<p>Invoice - {{ name }}</p> | |
</script> | |
<script type="text/x-handlebars" data-template-name="phone"> | |
<p>Contributor - {{ title }}</p> | |
</script> | |
<script type="text/x-handlebars" data-template-name="about"> | |
<p>About {{ title }}</p> | |
</script> | |
<script type="text/x-handlebars" data-template-name="index"> | |
<p>Index</p> | |
</script> | |
<script type="text/javascript" defer> | |
var App = Ember.Application.create({ | |
LOG_TRANSITIONS: true | |
}); | |
App.ApplicationView = Ember.View.extend({ | |
templateName: 'application' | |
}); | |
App.Router.map(function () { | |
this.route("about"); | |
this.resource("invoices", { path: "/invoices" }, function () { | |
this.resource("show", { path: "/:id" }); | |
}); | |
}); | |
var invoices = [ | |
{id: 1}, | |
{id: 2} | |
]; | |
App.AboutRoute = Ember.Route.extend({ | |
setupController: function (controller) { | |
// Set the IndexController's `title` | |
controller.set('title', "My App"); | |
} | |
}); | |
App.InvoicesIndexController = Ember.ArrayController.extend({ | |
invoices: invoices | |
}); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Why, when I click the invoices link, does the invoices/index template not render? When I read the docs it states it should render
(invoices/index in my case)