Error: approval failed: URL '/' does not match any route in application

I am testing the Ember.js environment and I am having a problem trying to load the page. Currently, I have two links on the page, and I'm just trying to figure out how to get one of the routes that will appear in {{outlet}}. Whenever I try to load a page, I get this error in my console. - Unused error: approval failed: error: approval failed: URL '/' does not match any routes in your application.

Here is my 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 is my 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({

});
+4
source share
1 answer

Ember / 'index' , , .

, :

App.Router.map(function(){
    this.route('index', { path: '/' });
    this.route('history');
});

, Ember / 'index' .

+3

Source: https://habr.com/ru/post/1545612/


All Articles