Javascript 自定义指令未解析$scope变量
我有一个自定义指令,但它没有解析$scope变量filterValue,如果我用实际值替换它,代码工作正常 不工作:-Javascript 自定义指令未解析$scope变量,javascript,angularjs,angularjs-directive,Javascript,Angularjs,Angularjs Directive,我有一个自定义指令,但它没有解析$scope变量filterValue,如果我用实际值替换它,代码工作正常 不工作:- <tableau-viz height="'500px'" url="'https://public.tableau.com/views/USMassShooting2013-2015TrendsPerState/Story1?:embed=y'" filters={{filterValue}}> </tableau-viz> <tableau
<tableau-viz
height="'500px'" url="'https://public.tableau.com/views/USMassShooting2013-2015TrendsPerState/Story1?:embed=y'" filters={{filterValue}}> </tableau-viz>
<tableau-viz height="'500px'" url="'https://public.tableau.com/views/USMassShooting2013-2015TrendsPerState/Story1?:embed=y'" filters="{'field1':['item1', 'item2'], 'dateField':{'min':startDate, 'max':endDate}}"> </tableau-viz>
工作:-
<tableau-viz
height="'500px'" url="'https://public.tableau.com/views/USMassShooting2013-2015TrendsPerState/Story1?:embed=y'" filters={{filterValue}}> </tableau-viz>
<tableau-viz height="'500px'" url="'https://public.tableau.com/views/USMassShooting2013-2015TrendsPerState/Story1?:embed=y'" filters="{'field1':['item1', 'item2'], 'dateField':{'min':startDate, 'max':endDate}}"> </tableau-viz>
我已经为此创建了一个JSFIDLE,请您看一下
提前感谢如果希望指令中的解析值使用模板中的{{}语法进行单向绑定,请更改指令对象: 筛选器:“=”到筛选器:@” 如果要传递模型并保持双向绑定,请删除模板中的{{}}:
<tableau-viz height="'500px'" url="'https://public.tableau.com/views/USMassShooting2013-2015TrendsPerState/Story1?:embed=y'" filters="filterValue"> </tableau-viz>
谢谢@Eeks33的帮助,它确实有帮助:)@Learner-没问题,如果有用,请将答案标记为正确;)干杯