0
在chrome中 - 兩個變體都有效。但是,在模擬ios時 - 使用templateUrl的指令確實不是的工作。Angular指令不能在離散應用程序中使用templateUrl進行渲染
這不會在IOS模擬器工作,但確實在瀏覽器中工作:
angular.directive('listitems', function(ApiEndpoint) {
return {
restrict: 'A',
templateUrl: '../template/listitems.ng.html',
scope: true
};
})
這作品在IOS模擬器並在瀏覽器工作:
angular.directive('listitems', function(ApiEndpoint) {
return {
restrict: 'A',
template: '<strong>listitems</strong>',
scope: true
};
})
在別處使用templateUrl在瀏覽器和ios模擬器中都能很好地工作。使用例如,當用戶界面路由器 - 我能夠加載外部模板沒有問題:
$stateProvider.state('app.dashboard', {
url: "/dashboard",
views: {
'menuContent': {
templateUrl: '../template/dashboard.ng.html',
controller: 'DigstackDashboard'
}
}
});
我的問題是 - 在該指令的情況下,爲什麼會在templateUrl價值不僅在IOS模擬器工作?
我會更新我的問題 - ApiEndpoint是一個常量 –
請告訴我'listitems.ng.html'的整個路徑 –
[app] /www/templates/listitems.ng.html請注意,此路徑工作正常在瀏覽器中渲染時 - 以及使用ui-router時。只是沒有指示。 –