Linked Questions
95 votes
2 answers
56k views
Directive isolate scope with ng-repeat scope in AngularJS
I have a directive with an isolate-scope (so that I can reuse the directive in other places), and when I use this directive with an ng-repeat, it fails to work. I have read all the documentation and ...
39 votes
7 answers
64k views
Callback function inside directive attr defined in different attr
So I have this directive called say, mySave, it's pretty much just this app.directive('mySave', function($http) { return function(scope, element, attrs) { element.bind("click", function() { ...
26 votes
10 answers
79k views
Input autofocus attribute
I have places in my code where I have this: <input data-ng-disabled="SOME_SCOPE_VARIABLE" /> I would like to be able to use it like this too: <input data-ng-autofocus="SOME_SCOPE_VARIABLE" /...
15 votes
5 answers
66k views
AngularJS Custom Directive Two Way Binding
If I have an AngularJS directive without a template and I want it to set a property on the current scope, what is the best way to do it? For example, a directive that counts button clicks: <...
23 votes
4 answers
21k views
How to use ng-show on a directive that has an isolated scope
I have a directive that I use like this: <dir model="data"></dir> The directive has an isolated scope. scope :{ model:'=' } Now I'm trying to use ng-show on that directive using ...
22 votes
4 answers
27k views
Can I use ng-model with isolated scope?
I am creating simple ui-datetime directive. It splits javascript Date object into _date, _hours and _minutes parts. _date uses jquery ui datepicker, _hours and _minutes - number inputs. angular....
19 votes
1 answer
8k views
Why does ng-style not work on the same element as a custom directive?
I'm trying to apply the ng-style attribute on a custom directive tag, kind of like so: <my-directive ng-style="myStyle"></my-directive> Inside the controller I have: $scope.myStyle = { ...
7 votes
2 answers
5k views
How to prevent that a scope is shared among directives n Angular?
All my directives use the same scope and I want my directives to operate by their own. Directive: app.directive('headerSort', function () { return { restrict: 'A', controller: ...
3 votes
3 answers
8k views
Angular communication between controllers and directives
I have this piece of code which allows a user to leave comments on a list of items. I created a directive and listen to keydown in order to let the user submit a comment if keyCode == 13. Not sure ...
0 votes
2 answers
3k views
Angular two different directives with same controller share scope
I'm creating two directives which use the same controller, as a result I see that both directives share data among controller. What I want is that data to be UNIQUE per directive, so data shouldn't be ...
5 votes
1 answer
2k views
Why formatters does not work with isolated scope?
Why formatters does not work with isolated scope? Is this angular bug or I am doing something wrong? This contains isolates scope and does not work: http://jsfiddle.net/YbdXQ/56/ restrict: 'A', ...
7 votes
1 answer
5k views
Evaluating an expression in an attribute of a directive in AngularJS
I did a lot of workaround, searched and researched, but I can't figure how to achieve my goal. - The problem: I have a the following situation, I want to avoid the user can overlap commissions dates ...
2 votes
3 answers
3k views
Multiple AngularJS directives with different scopes
Hi I have a two popup directives on the same page. The problem is when I click on one they both pop up. How can I isolate each scope from each other so only the popup that's clicked pops up? HTML &...
2 votes
2 answers
2k views
How to make sibling directives communication work( communication between certain specific directive)
All: Suppose I have two directives( dir1 and dir2) , which are both isolated scope. From some posts, I learnt that I need to use "require" to get scope of the other directive, but there is one ...
2 votes
3 answers
2k views
How to watch and re-evaluate expression in directive?
I am trying to write custom directive and one of the requirements is that I should be able to disable one of the elements based on the expression set on attribute of the directive. Directive is ...