[英]Error: [$compile:tpload] Failed to load template in Angular
Example : 范例:
registry.html registry.html
<label>Name:</label>
app.js app.js
define(['angular', 'services','text',
'text!ang/templates/registry.html'], function(angular, services,textmod,template) {
........
angular.module('myApp.directives', ['myApp.services'])
.directive('superd', function() {
return {
templateUrl:template,
..........
}
})
Eror : 错误:
GET app_ang/%3Clabel%3EName:%3C/label%3E 403 (Forbidden) angular.js?bust=1417672731204137.41101580671966:10023 GET app_ang /%3Clabel%3EName:%3C / label%3E 403(禁止)angular.js?bust = 1417672731204137.41101580671966:10023
Error: [$compile:tpload] Failed to load template: <label>Name:</label>
错误:[$ compile:tpload]无法加载模板:
<label>Name:</label>
Note : 'text' is https://github.com/requirejs/text 注意:'text'是https://github.com/requirejs/text
I don't think you need to depend on 'text'
directly. 我认为您不需要直接依赖
'text'
。
define([
'angular',
'services',
'text!ang/templates/registry.html'
], function(angular, services, template) {
//...
angular.module('myApp.directives', ['myApp.services'])
.directive('superd', function() {
return {
templateUrl: template,
//...
};
});
And in your require config: 并在您的require config中:
require.config({
//...
paths: {
// path example if you are using bower
'angular': '/bower_components/angular/angular',
'text': '/bower_components/requirejs-text/text'
},
shim: {
'angular': {
exports: 'angular'
}
}
});
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.