Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/macos/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Angularjs 未加载角度指令templateURL。为什么?_Angularjs_Angularjs Directive_Mean.io - Fatal编程技术网

Angularjs 未加载角度指令templateURL。为什么?

Angularjs 未加载角度指令templateURL。为什么?,angularjs,angularjs-directive,mean.io,Angularjs,Angularjs Directive,Mean.io,我在Angular中创建了一个指令。当我使用模板属性时,指令“编译”。使用模板URL时,它不会在中编译 templateURL文件不在angular页面的控制台或网络选项卡中。它是200作为一个浏览器URL 我错过了什么 'use strict'; angular.module('mean.profile').directive('inProfileSidebar', function() { return { restrict: 'A', scope: { d

我在Angular中创建了一个指令。当我使用
模板
属性时,指令“编译”。使用
模板URL
时,它不会在中编译

templateURL文件不在angular页面的控制台或网络选项卡中。它是200作为一个浏览器URL

我错过了什么

'use strict';

angular.module('mean.profile').directive('inProfileSidebar', function() {
  return {
    restrict: 'A',
    scope: {
      data: '=',
      editable: '=',
    },
    template: '<div><h2>inProfileNarrow</h2><div>{{data}}</div><div>{{editable}}</div></div>',
//    templateURL: '/profile/views/inProfileSidebar.html',
  };
});
在此HTML中使用:

<div class="col-md-4">
  <div in-profile-sidebar data="data.profile" editable="data.profile.editable"></div>
</div>

我在浏览器控制台中没有看到任何错误,并且在浏览器的网络日志中没有对templateURL的请求


当我使用
template
时,它可以工作,但与
templateURL
不一起工作。为什么?

我没有对它进行测试,但从快速查看的结果来看,似乎您对该属性的命名不正确


它应该是“templateUrl”,而不是“templateUrl”(只有“U”是大写)。

就是这样!谢谢
<div class="col-md-4">
  <div in-profile-sidebar data="data.profile" editable="data.profile.editable"></div>
</div>