안녕하세요 각도 JS각도 JS 여러 지침
var app = angular.module("myApp", []);
app.controller("myController", function($scope){ });
app.directive("myDirective1", function(){ return {
template: "<h1> hello this is directive with template </h1>" }; });
app.directive("myDirective2", function(){ return{
restict: 'A',
templateUrl: /directiveTry.html }; });
에서 여러 지시를 시도하고 난 단 하나의
<h1> hello I am external on file </h1>
이 main.html
<body ng-controller= "myController as myCtrl">
<h1>Hello Plunker!</h1>
<my-Directive1></my-Directive1>
<my-Directive2></my-Directive2>
</body>
및 directiveTry.html을 만들었습니다
텍스트를 표시 할 수 없습니다. 어디에서 오해합니까? 답변
덕분에
restict : 매개 변수가 없습니다. 그것은'restrict'이고 A는 속성을 나타냅니다. E를 찾고 있습니다. 또한 templateUrl 값을 따옴표로 묶어야합니다. 문자열입니다 –
확인 완료되었지만 지시문을 표시하지 않습니다 – nowaySync
구문은