1
我希望能够在Angular客户指令的链接函数内的范围变量中设置一个变量的ng-show。从链接函数中指令范围的变量设置角度的ng-show
angular.module('myApp')
.directive('testDir', function() {
return {
template: <div ng-show="{{showme}}"> hello </div>,
link: function (scope, element, attrs) { //
scope.showme=true;
}
});
不幸的是,当我这样做时,它不能按预期工作。如果我设置scope.showme = true,那么我的指令是隐藏的。如果我将它设置为false,则显示它。我怎么搞砸了?