这是我的指令:
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