1
我需要在html中調用angular.isString()方法。但我不知道如何訪問它。我的解決方案是添加一個控制器屬性並將角度對象綁定到隔離的作用域。這很奇怪!我想知道是否有更好的方法來做到這一點?如何在指令的隔離範圍內訪問全局角對象?
Javscript:
App.directive "tfsTaskDetails",()->
restrict: 'AE'
replace: true
templateUrl: '../../templates/task_details.html'
scope:
task: '='
controller: ($scope)->
$scope.angular = angular
HTML:
<p ng-if="angular.isString(task.name)">task.name</p>