What is `priority` of ng-repeat directive can you change it?

Yes, you can set the priority of a directive. ng-repeat has a priority of 1000, which is actually higher than custom directives (default priority is 0). You can use this number as a guide for how to set your own priority on your directives in relation to it. angular.module(‘x’).directive(‘customPriority’, function() { return { priority: 1001, … Read more

Handling ng-click and ng-dblclick on the same element with AngularJS

You could just write your own. I took a look at how angular handled click and modified it with code I found here: Jquery bind double click and single click separately <div sglclick=”singleClick()” ng-dblClick=”doubleClick()” style=”height:200px;width:200px;background-color:black”> mainMod.controller(‘AppCntrl’, [‘$scope’, function ($scope) { $scope.singleClick = function() { alert(‘Single Click’); } $scope.doubleClick = function() { alert(‘Double Click’); } }]) … Read more

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

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

AngularJS directive $destroy

The i18n example you provided would work if you only ever used it once. I don’t think you should be doing the event binding inside the compile function. You can do it inside the link function instead: angular.directive(‘i18n’, [‘$rootScope’, ‘LocaleService’, function($rootScope, LocaleService) { return { restrict: ‘EAC’, link: function(scope, element, attrs) { var cleanup; var … Read more

AngularJS UI Bootstrap Tabs that support routing

To add routing you typically use an ng-view directive. I’m not sure it’s easy enough to modify angular UI to support what you’re looking for, but here’s a plunker showing roughly what i think you’re looking for (it’s not necessarily the best way of doing it – hopefully someone can give you a better solution … Read more