How can I check if an angular model is an array or an object? Is there a built in or do I have to write a filter isArray
with Array.isArray()
{{[] | isA
I guess you can also add underscore/lodash to the rootScope and use it:
_ = require('lodash')
angular.module('app',[])
.run(function($rootScope){
$rootScope._ = _
})
And in the template:
{{ $root._.first(foo) }}
The benefits - you have to add lodash only in one place, and it will be available everywhere. You can use many other things the same way, like Math
functions for example. Just be reasonable and don't put too much javascript into expressions.