1

스크립트 태그 안에 모든 템플릿을 넣고 아약스 요청을 사용하지 않고도 내 지시문에서 사용하고 싶습니다. 이 내 지시어입니다AngularJS - 사전로드 된 템플릿이 지시어와 함께 작동하지 않습니다.

<script id="article_row.html" type="text/ng-template"> 
    <tr> 
     <td class="article-id">[[ article.id ]]</td> 
     <td>[[ article.title ]]</td> 
     <td>[[ article.user_id ]]</td> 
     <td>[[ article.created_at ]]</td> 
     <td> 
      <article-restore id="article.id"></article-restore> 
     </td> 
    </tr> 
</script> 

:

내 템플릿입니다

app.directive("articleLine", [function(){ 

    return { 

     return: 'E', 
     scope: { 
      article : "=data" 
     }, 
     templateUrl: "article_row.html" 

    }; 

}]); 

로드, 나는 콘솔에서이 오류를 얻을 때 :

Error: Failed to load template: article_row.html 

을 그리고 난에 표시 브라우저에서 가져 오려고하는 콘솔 http://localhost/articles/article_row.html 대신 찾고 있습니다. 페이지에 내가 뭔가 잘못하고 있니?

감사합니다. 당신이 위의 articelLine 지시를 넣을 때, 당신은 당신의 article_row.html NG-템플릿을 포함하고 오류가 발생하기 전에

+1

피들/플 런커를 제공해주세요. 코드를 보지 않고 첫 번째 추측은 템플릿을 가진'

관련 문제