In AngularJS directives are a way to teach HTML new tricks by extending the HTML vocabulary. Directives allow you to manage DOM elements in a declarative pattern, freeing you from low level DOM manipulation tasks.

learn more… | top users | synonyms

24
votes
3answers
2k views

When writing a directive, how do I decide if a need no new scope, a new child scope, or a new isolate scope?

I'm looking for some guidelines that one can use to help determine which type of scope to use when writing a new directive. Ideally, I'd like something similar to a flowchart that walks me though a ...
6
votes
5answers
2k views

Angular.js: How to autocapitalize an input field?

How to autocapitalize the first character in an input field inside an angular.js form element? I saw the jQuery solution already, but believe this has to be done differently in angular.js by using a ...
2
votes
2answers
445 views

AngularJS: Complex directives for custom tags

I'm working on a project to render HTML taking a special XML as input. I succeed already with the basic case. For example: <mybutton name="layla"></mybutton> is converted to <div ...
7
votes
2answers
4k views

How to set focus in AngularJS?

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 ...
4
votes
1answer
520 views

How to create a custom input type in Angular.js?

I'm new to Angular.js and would like to create a custom input type similar to the way angular.js implements "email", for example. <input type="email" ng-model="user.email" /> What I would ...
0
votes
1answer
459 views

prevent multiple form submissions using angular.js - disable form button

I want to prevent multiple form submissions using angular.js. The question is related to this question. When the user clicks on a form submit button the value / label of the submit button should ...
2
votes
1answer
291 views

how to write a directive in angularjs

i like to make a custom component using directive. i checked lot of tutorials and its get confusing me can anyone explain how a directive works. the component i am planing to make is ...
2
votes
1answer
370 views

Watch controller model value from inside directive

I am trying to have angular watch the $viewValue of a controller from inside a directive. fiddle: http://jsfiddle.net/dkrotts/TfTr5/5/ function foo($scope, $timeout) { $scope.bar = "Lorem ...
0
votes
1answer
306 views

A Simple Uploader using AngularJs (with CORS Implementation)

Recently, I had to write a simple uploader (reusable) using AngularJs, while, keeping my API in separate place and finally wrote one using blueimp jQuery File Uploader and made lil customizing it. I ...
0
votes
1answer
270 views

Angular.js filters and functions on scope that is changing every second

The problem. I have a table of entries($scope.entries), each row(ng-repeat) with 5 columns, 2 of those columns have custom made filter for various transformations. Now in the same scope I have ...
11
votes
2answers
5k views

AngularJS call method in directive controller from other controller

I am trying to figure this one out but it seems google is not my friend today so I'm going to ask you guys here. Basically I have a directive that has its own controller. See the below code: var ...
4
votes
1answer
463 views

Angular and i18next

I have seen some i18n plugins for Angular but I don't want to re-invent the wheel. i18next is a good library and so, I intend to use it. I have created a directive i18n which just calls i18n library: ...
4
votes
1answer
514 views

AngularJS: Fields added dynamically are not registered on FormController

I have the following static form in AngularJS: <form name="myForm" class="form-horizontal"> <label>First Name:</label> <input type="text" name="first_name" ...
4
votes
1answer
640 views

What is the best approach to test events in angular?

How can i test for events in angular js? I need to test the following code, but I have little experience testing. I figured i need to use spies in some way to see if events have fired or something, ...
1
vote
1answer
260 views

Angular.js custom iterations/data transformations and grouping… when simple ng-repeat just won't cut it

Still this problem Angular.js more complex conditional loops but I felt that the answer to the question as it was asked was right so I accepted it. So let me elaborate more than I did in the original ...

1 2 3 4 5
15 30 50 per page