【发布时间】:2012-10-14 10:20:35
【问题描述】:
这是我的指令:
app.directive("helloWorld", function() {
return {
restrict: "E",
scope: {
name: "bind"
},
template: "<div>a {{name}} a</div>"
};
});
我是这样使用它的:
<hello-world name="John Smith"></hello-world>
我希望这个页面在我运行时是这样的:
<hello-world>
<div>a John Smith a</div>
</hello-world>
但由于某种原因,name 没有注入,实际结果是这样的:
<hello-world>
<div>a {{name}} a</div>
</hello-world>
我缺少什么吗?我正在使用 Angular JS 1.0.2
【问题讨论】:
标签: javascript templates angularjs