- Templateurl: The URL to use to load the template.
- You can load the corresponding Text/ng-template script ID within the current template.
- When using chrome, the same-origin policy prevents Chorme from loading the template from file://and displays a "access-control-allow-origin" that does not allow the source to be null, either to load the project on the server, or to Chorme Set a flag bit with the command: Chorme-allow-file-access-from-files.
<!DOCTYPE HTML><HTMLLang= "en"><Head> <MetaCharSet= "UTF-8"> <title></title></Head><Body> <DivNg-app= "MYAPP"> <Scripttype= "Text/ng-template"ID= "CustomTags2"> <Div>Hello {{name}}</div> </Script> <DivNg-controller= "Firstcontroller"> <Custom-tags></Custom-tags> <CUSTOM-TAGS2></CUSTOM-TAGS2> </Div> </Div><Scripttype= "Text/javascript"src=".. /.. /vendor/angular/angularjs.js "></Script><Scripttype= "Text/javascript"src= "App/index.js"></Script></Body></HTML>
< Div > {{Name}} </ Div >
varMyApp = Angular.module (' MyApp ', []). Directive (' Customtags ',function () { return{restrict:' eCAM ', Templateurl:' Tmp/other.html ', replace:true}}). directive (' CustomTags2 ',function () { return{restrict:' eCAM ', Templateurl:' CustomTags2 ', replace:true}}). controller (' Firstcontroller ', [' $scope ',function($scope) {$scope. Name= ' Alrale ';}]);
ANGULARJS[26]-custom Directive (2) (Templateurl)