0
我想创建一个angulajrs
可重复使用的html
组件,所以我可能不得不去directives
。我创建了一个简单的,它不工作:如何使用angularjs指令创建可重用组件?
<my-fn info="test"></my-fn>
app.directive('my-fn', function() {
return {
restrict: 'E',
templateUrl: 'templates/my-fn.html',
scope: {
info: "=info"
}
};
});
我-fn.html:
<p>the value is: {{info}}</p>
结果:我没有看到任何东西,并且在控制台中没有错误。
如何确保指令加载并找到模板?