All Questions

953
votes
15answers
477494 views

What is the difference between '@' and '=' in directive scope in AngularJS?

I've read the AngularJS documentation on the topic carefully, and then fiddled around with a directive. Here's the fiddle. And here are some relevant snippets: From the HTML: <pane bi-title="ti...
117
votes
12answers
105800 views

Controller not a function, got undefined, while defining controllers globally

I am writing a sample application using angularjs. i got an error mentioned below on chrome browser. Error is Error: [ng:areq] http://errors.angularjs.org/1.3.0-beta.17/ng/areq?p0=ContactControl...
683
votes
31answers
488150 views

How to set focus on input field?

What is the 'Angular way' to set focus on input field in AngularJS? More specific requirements: When a Modal is opened, set focus on a predefined <input> inside this Modal. Everytime <inpu...
13
votes
2answers
1330 views

Is this a "Deferred Antipattern"?

I'm finding it hard to understand the "deferred antipattern". I think I understand it in principal but I haven't seen a super simple example of what a service, with a differed promise and one with ant...
191
votes
7answers
96708 views

Add directives from directive in AngularJS

I'm trying to build a directive that takes care of adding more directives to the element it is declared on. For example, I want to build a directive that takes care of adding datepicker, datepicker-la...
466
votes
7answers
178918 views

When to favor ng-if vs. ng-show/ng-hide?

I understand that ng-show and ng-hide affect the class set on an element and that ng-if controls whether an element is rendered as part of the DOM. Are there guidelines on choosing ng-if over ng-sho...
300
votes
6answers
230785 views

How to access parent scope from within a custom directive *with own scope* in AngularJS?

I'm looking for any manner of accessing the "parent" scope within a directive. Any combination of scope, transclude, require, passing in variables (or the scope itself) from above, etc. I'm totally ...
190
votes
4answers
180628 views

How to set an iframe src attribute from a variable in AngularJS

I'm trying to set the src attribute of an iframe from a variable and I can't get it to work... The markup: <div class="col-xs-12" ng-controller="AppCtrl"> <ul class=""> <...
84
votes
6answers
46313 views

angular ng-bind-html and directive within it

Plunker Link I have a element which I would like to bind html to it. <div ng-bind-html="details" upper></div> That works. Now, along with it I also have a directive which is bound to th...
427
votes
8answers
134137 views

Angular directives - when and how to use compile, controller, pre-link and post-link

When writing an Angular directive, one can use any of the following functions to manipulate the DOM behaviour, contents and look of the element on which the directive is declared: compile controller...

Previous Next