angularjs - How to call a function from global API in Angular expressions? -


angular.js provides banch of global functions angular.lowercase, angular.isarray etc.

suppose have string in scope:

function mycontroller($scope) {    $scope.mystring = "test" } 

calling angular.lowercase has no effect:

{{lowercase(mystring)}} {{angular.lowercase(mystring)}} 

how can call such function in template?

update

example angular.isarray

<div ng-show="isarray(myvar)">...</div> 

the expression in {{}} not actual javascript although looks way - it's angularjs expression. reason not available you.

charlietfl right particular case can solved existing filter. not every angular.* function exposed way, however, in case should create own custom filters.

filters cleanest dirty workaround have following line in controller:

$scope.lowercase = angular.lowercase;  // not angular.lowercase() 

Comments

Popular posts from this blog

ios - iPhone/iPad different view orientations in different views , and apple approval process -

java Extracting Zip file -

C# WinForm - loading screen -