我有一个angularJS指令,通过以下方式调用:
指令代码如下:
.directive('rptClosing',function(){ return { restrict:'E', scope: { closingBeginTs: '=', closingEndTs: '=' }, link: function(scope, element, attrs) { console.log('*******************************************'); console.log('scope = ', scope); console.log('scope.closingBeginTs = ', scope.closingBeginTs); console.log('scope.closingEndTs = ', scope.closingEndTs); console.log('*******************************************'); }, template: 'BLAH BLAH BLAH' }; } )
这段代码在jsFiddle中运行得非常好.我能看到的价值scope.closingBeginTs
,并scope.closingEndTs
在控制台输出.
它记录为未定义,因为它未定义.在您提供的代码段中,两个属性都是closing-begin-ts
.
当然应该是: