Search code examples
angularjsnw.jsangularjs-ng-route

angularjs ng-route. not work templateUrl


It does not work with the specified templateUrl: test.html but works if you specify the template: 'Hello '

WORK

app.config(function($routeProvider){
    $routeProvider
    .when('/test', {
        template: '<h1>home</h1>',
        controller: 'ctrl'
    })

    // .otherwise({
    //  redirectTo: '/home',
    //  controller: 'ProductCtrl'
    // });
});

DO NOT WORK

app.config(function($routeProvider){
    $routeProvider
    .when('/test', {
        templateUrl: 'test.html',
        controller: 'ctrl'
    })

    // .otherwise({
    //  redirectTo: '/home',
    //  controller: 'ProductCtrl'
    // });
});

and I have a sign ! in the path to the file that is #!/test

LINK

<a style="color:white;" href="#!/test">Go</a>

I'm using nw.js


Solution

  • You could try to put a path to your template url

    .when('/test', {
       templateUrl: './test.html',
       controller: 'ctrl'
      })