What does “require” of directive definition object take?

The require parameter, including its prefixes, is documented on the $compile API reference page. Require another directive and inject its controller as the fourth argument to the linking function. The require takes a string name (or array of strings) of the directive(s) to pass in. If an array is used, the injected argument will be … Read more

AngularJS : ng-repeat filter when value is greater than

Create a predicate function on the relevant scope: $scope.greaterThan = function(prop, val){ return function(item){ return item[prop] > val; } } As a first argument, it takes a property name on the object. The second argument is an integer value. Use it in your view like this: <tr ng-repeat-start=”list in Data.Items | filter: greaterThan(‘NumberOfStamps’, 0)”> Demo

In the AngularJS BootstrapUI Typeahead, what’s $viewValue?

here is a working typeahead example: <div class=”container”> <div ng-controller=”mainCtrl” class=”row-fluid”> <form class=”row-fluid”> <div class=”container-fluid”> <input type=”text” ng-model=”selected” typeahead=”state for state in states | filter:$viewValue” /> </div> </form> </div> </div> <script> angular.module(‘myApp’, [‘ui.bootstrap’]) .controller(“mainCtrl”, function ($scope) { $scope.selected = ”; $scope.states = [‘Alabama’, ‘Alaska’, ‘Arizona’, ‘Arkansas’, ‘California’, ‘Colorado’, ‘Connecticut’, ‘Delaware’, ‘Florida’, ‘Georgia’, ‘Hawaii’, ‘Idaho’, ‘Illinois’, … Read more

Orderby not working with dict syntax on ng-repeat

The parameters to orderBy must match property names in an array of objects. Your data needs to look something like this: $scope.list2 = [ { id:”2013-01-08T00:00:00″, name:’Joe’}, { id:”2013-01-09T00:00:00″, name:’Sue’}]; Then a filter like this will work: <div ng-repeat=”item in list2 | orderBy:’id’:true”> Fiddle. Note that orderBy works on the entire array (something in your … Read more

Custom child directive accessing scope of parent

The city directive $parent is a transcluded scope of state directive. The transcluded scope of the state directive is inherit for $parent of state directive which is controller thus that is why $parent.MyName = India. The $parent of transcluded scope is the state directive isolated scope ( scope = {} ) that is why $parent.$parent.MyName … Read more

ng-click doesn’t work within the template of a directive

You’ve got a scope issue. Since you used isolated scope in your directive with scope: { value: ‘=’ }, it no longer has access to your controller’s scope that has editQuestion. You need to pass editQuestion along to your directive’s scope so it knows how to call it. This is typically pretty easy, but because … Read more