javascript - Error: Assertion Failed: The URL '/' did not match any routes in your application -
i testing out ember.js framework , running problem when seek load page. have 2 links on page , trying figure out how 1 of routes displayed in {{outlet}}. whenever seek load page error in console - uncaught error: assertion failed: error: assertion failed: url '/' did not match routes in application
here html file
<!doctype html> <html> <head lang="en"> <meta charset="utf-8"> <link rel ="stylesheet" href="css/normalize.css"> <link rel ="stylesheet" href="css/style.css"> <script src="http://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.1/jquery.js"></script> <script src="http://cdnjs.cloudflare.com/ajax/libs/handlebars.js/1.1.0/handlebars.js"></script> <script src="http://cdnjs.cloudflare.com/ajax/libs/ember.js/1.5.1/ember.js"></script> <script src="js/app.js"></script> </head> <body> <script type="text/x-handlebars" data-template-name="application"> <div> {{#link-to 'index'}} home {{/link-to}} {{#link-to 'history'}} history {{/link-to}} </div> <div> {{outlet}} </div> </script> <script type="text/x-handlebars" data-template-name="index"> <h1> index route test</h1> </script> <script type="text/x-handlebars" data-template-name="history"> <h1> history route test</h1> </script> </body> </html> here js file
var app = ember.application.create({ log_transitions:true }); app.router.map(function(){ this.route('index'); this.route('history'); }); app.indexroute=ember.route.extend({ });
ember automatically routes / 'index' template , corresponding controller without having explicitly name in router, dont have include index route @ all.
if want maintain in use:
app.router.map(function(){ this.route('index', { path: '/' }); this.route('history'); }); more info on why ember routes / 'index' here.
javascript html web ember.js routes
No comments:
Post a Comment