2017-10-18 2 views
1

그것은 지정된 templateUrl 작동하지 않습니다 작동하지 '안녕하세요'angularjs ng-route. 템플릿 지정하는 경우 test.html를하지만, 작동 : templateUrl

WORK를

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

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

작동하지 않는

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

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

나는 파일에 대한 경로에 !이라는 기호가 있습니다. #!/test

링크

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

내가 사용하고 nw.js

+1

당신이 – jitender

+0

이를 참조하여 인 test.html 파일을 넣을 폴더 구조를 보여 템플릿 URL에 대한 경로를 넣어 시도 할 수 https://stackoverflow.com/questions/40635098/angularjs-routing-with-templateurl –

답변

1

당신은

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