6
我如何可以添加自定义字段的角度范围与通过字段属性一起,如下:AngularJs定制指令隔离范围的自定义字段
angular.module('app')
.directive("myDirective", function(){
function NewObj()
{
this.id = 0;
this.name = "";
}
return{
restrict: "E",
templateUrl:"partials/directives/temp.html",
scope:{
viewId:"=",
dataObj: new NewObj() //This is the custom obj
}
}
}
当我这样做,我得到无效的隔离范围定义。 这怎么可能被帮助?
下面是关于指令范围像样的解释:http://umur.io/angularjs-directives-using-isolated-scope-with-attributes/ –