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

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

Saving new models using AngularJS and $resource

The first think you should note, that scope != model, but scope can contain model(s). You should have some object in your scope and then save it. So, there would be something like the following: HTML: <div ng-controller=”entryController”> <input type=”text” ng-model=”poll.name”><br/> <textarea ng-model=”poll.description” required></textarea><br/> <button class=”btn btn-primary” ng-click=”saveEntry()”>Save</button> </div> JavaScript: function pollController($scope, $resource) { var … Read more

After upgrading TypeScript, Angular controller registration now fails to compile

Since all of the properties of IController are optional, I believe the errors you are seeing are a result of the new checking for “Weak Types” in TypeScript 2.4. Check this link from Microsoft for details. Also check this related Github issue. Some relevant quotes from Microsoft: In TypeScript 2.4, we’re adding a similar check … Read more