sircamp
sircamp

Reputation: 107

How to print a template in Ember

i've this in my html:

<script type="text/x-handlebars" template-name="index">
    <h1>Login Page</h1>
    {{#linkTo "index"}}<img class="logo">{{/linkTo}}
    <button {{action doLogin}}>Login</button>
</script>

and i've this in my router.js:

myTalk.Router.map(function() {
   this.route('index', {path:"index"});
});

but i've this error:

Uncaught Error: No route matched the URL '..../index.html' 

thanks in advance and sorry for bad my english

Upvotes: 0

Views: 664

Answers (1)

Mike Grassotti
Mike Grassotti

Reputation: 19050

There are a few things going on here.

First, template-name is not the right way to name your template. Change template-name="index" to either id="index" or data-template-name="index"

Second, you should not need to specify path to the index template. By default ember creates one for automatically, with path set to /. So in this case you don't even need a router definition

Finally, seems you're loading the page with URL set to ..../index.html and that's not going to match anything in ember.

Here's a working jsFiddle: http://jsfiddle.net/mgrassotti/XfDjm/1/

Upvotes: 1

Related Questions