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

0
votes
0answers
4 views

Problems with ng-repeat and ajax-loaded content in directive

I'm creating some directive that wraps up jCarousel plugin. But content for it loading dynamically via ajax. So here are examples of my code: Calling directive in HTML: <div class="jcarousel" ...
0
votes
1answer
12 views

Disable text selection with Angular directive

I am learning JavaScript and AngularJS. I want to disable text selection with Angular Directive. I have a JavaScript code for that function: function clearSelection() { if(document.selection ...
0
votes
1answer
17 views

how to make ng-model value set by ui-select value

I am currently using angular-ui/ui-select in my project. I am able to bind the value of the ui-select to an object without issue, however it is binding the entire item that is being iterated over. I ...
-1
votes
1answer
16 views

Angular directive: watching an expression consisting of variable and function

everyone! Thanks in advance! I have the following problem: I want to watch an input field's attribute, which at the same time is my directive's name, to focus and select the value when a) the area ...
0
votes
2answers
18 views

Adding or duplicating directive dynamically does not get variable values from parent scope

I'm trying to figure out how I can dynamically duplicate my directive and at the same time maintain the variables from my parent scope. here's a fiddle to make it clearer ...
-1
votes
2answers
19 views

Angularjs directive: Passing a model reference to an isolated scope

I 'm trying to write a collapsible, reusable calculator directive, that binds to an input field (in the parent scope). This input field itself has a ngModel binding. When the user presses the ...
0
votes
0answers
18 views

Ng-Grid: Cannot read property 'on' of null

I am working on developing an angular.js directive which is simply a JQuery dialog box with a grid within it. Directive Template: <div class="datasetsGrid" ng-grid="gridOptions"></div> ...
-1
votes
1answer
18 views

what is the best way to attach events to children elements when using directives in angular

i am little bit confused about directives.I want to make a combobox and it consists of multiple elements. angular guys say do not make any manipulation in the controller so they point link function. ...
-1
votes
0answers
11 views

Change module config data from controller - AngularJS

I have implemented Session timeout using AngularJS Below is code: var user = angular.module('user', ['ui.bootstrap', 'xeditable', 'ngIdle']); user.config(function($httpProvider, ...
0
votes
0answers
21 views

How can I output a script tag that is stored as a string in my scope to an AngularJS template?

I need to use an embedded script in my templates but dynamically insert a path to an image before the script runs. I've written a directive to build the image path as a scope variable, then use ...
1
vote
0answers
24 views

How to add field in ng-form, if this field is located out of ng-form (AngularJS)

I have: <ng-form name="myForm"> <input...> <input...> <input...> </ng-form> <special-field ng-model="myField" /> and I need to add 'special-field' in ...
0
votes
1answer
21 views

Asterisks in input field indicating length with angularjs

I'm using angularjs for a app I'm working on. I need an input field with a specific length of characters a user has to enter. To indicate how long the input should be, I would like to have an input ...
0
votes
0answers
20 views

Angularjs Directive initialized in different order in IE11 and FireFox31

I have a directive where I define a link function in which I added few login listeners(custom). And the respective broadcast will happen from a factory based on a condition. which is the function in ...
0
votes
2answers
32 views

Javascript inside script tag in an Angularjs template is not executed

I have a simple directive that displays three images. On mouse hover, it should switch from black and white to normal image. Below given is the code inside the directive. <div ...
0
votes
2answers
22 views

Angular - Populating JSON data in Select

I am populating JSON data in Select/options. The problem is once user selects an item, value attribute displays the selected JSON data (including itemID and itemName) rather than just displaying ...
0
votes
0answers
15 views

TemplateUrl not working in Angular

I'm experimenting with Angular, and I just don't understand why my directive won't work on my computer. When I use 'template' in my directive, I get the result I want, but when I do the 'templateUrl' ...
0
votes
1answer
12 views

Add Properties after json load

I have this json: { "info": [ { "id": 999, "products": [ { "id": 1, }, { "id": 2, } ] } ] } Info -- products -----id And my factory: AppAngular.factory('model', ...
0
votes
1answer
29 views

How to simulate time passing in angularjs test?

I am trying to pass a simulate time passing in an angularjs jasmine test. My directive that I am testing simply displays the current time and updates every second: return { restrict: 'A', scope: ...
0
votes
1answer
13 views

How do I trigger a click event in a unit test for an Angular directive

I have an Angular app (running from an ASP.NET MVC project.) In this app, I have a directive with the following link function: link: function (scope, element, attrs, formCtrl) { ...
-1
votes
1answer
22 views

Shift click to add value to object without using angular directive

In HTML file: ... <ul> <li><a href="#" ng-click="addFruit('Apple')">Apple</a></li> <li><a href="#" ...
0
votes
1answer
21 views

Test for directive watch fails; only fired first time

I am attempting to pass a test for my angularjs directive using jasmine. My directive simply takes what is passed into the attribute (as a one way binding) and replaces the elements text with that ...
0
votes
1answer
22 views

AngularJS bindonce directive

I have simple directive for calculating "ago" .directive('ago', ['$timeout', function($timeout) { return { restrict: 'E', scope: { time: '@' },   ...
0
votes
1answer
16 views

What name restrictions do exist for attributes that are used with &-binding in Angular directives

In the following code I use the attribute selected for a callback from a directive to its parent controller. I noticed that when I change selected to something like setSelected or XXXSelected (the ...
0
votes
1answer
11 views

AngularJS nested directives, inner directive's ng-click is not firing

This is a problem I'm having in my app and I am about to reproduce it in a simple example: <div f-outer> <div f-inner dat="dat"> <a href="javascript:" ng-click="run(dat, ...
2
votes
2answers
49 views

How to make options from select directive bound with another array?

Update: here is the jsfiddle: http://jsfiddle.net/robertyoung/jwTU2/9/ I'm building a webpage/app using AngularJS. The function I want is, when the user add a row to the timecards table, he is able ...
0
votes
0answers
8 views

Angular custom directive with parameter

I want to create a custom directive in angularjs with a parameter depending of an external json to display dynamically datas in my html. I show you the code: HTML <div class="sg-anchor-target" ...
0
votes
1answer
20 views

One directive for multiple DOM manipulation

I have a web page containing two distinct zones. In the first zone I'm drawing a force graph (my-graph(data="datagr")), when the user clicks on a node of this graph I'm trying to update the second ...
-2
votes
2answers
22 views

Checking for current route in directive

When a webpage loads for the first time, controller of my directive needs to know what is the currently selected route. After first load I can detect change using $scope.$on('$routeChangeSuccess', ...
0
votes
0answers
13 views

Adding nested ng-form's within a table using ng-repeat

I'm building a dynamic table with ng-repeat where each row is a record in my database. Some of these fields are allowed to be editable and I find out which ones are through my ...
0
votes
2answers
23 views

AngularJs: Run function when any element in section is blurred

I've created the following directive: .directive('onSectionBlur', function ($parse) { return { restrict: 'A', controller: function ($scope, $element, $attrs) { ...
1
vote
0answers
29 views

Angular JS: Single edit hyperlink option for all the field edits

I have created an application in angularjs with edit, save and cancel options, the application is working fine, right now i am having edit option for all the three fields, but how can i have a single ...
0
votes
0answers
30 views

Input tagging for images

I am new in AngularJs. I am trying to build a project. I have a set of images added. When I click one image it should pop up and shud be able to add tags and delete it.The image shud populate in the ...
1
vote
1answer
44 views

How do I dynamically add an AngularJS directive to an element conditionally?

So I can't really get this to work, I've got the following code HTML: <!doctype html> <html ng-app="plunker" > <head> <meta charset="utf-8"> <title>AngularJS ...
1
vote
0answers
14 views

App Already Bootstrapped with this Element when using ng-include

I want to create a custom panel for controlling different files. I am trying to use ng-include or a directive but both of them throw this error: "App Already Bootstrapped with this Element" What I am ...
0
votes
0answers
25 views

AngularJS REST service calls: How to exchange data between provider, controller and directive?

I have two REST web services which I have to call one by one. The first one return some data which I have to use for the second REST service call. The result of the second one, I need to provide it to ...
0
votes
1answer
13 views

Sigma.js in Angularjs

I am having trouble using Sigma.js inside an Angular directive. The steps I am taking are: I have built my app with yeoman. I have installed sigma as a bower_component and did run npm run build to ...
1
vote
3answers
51 views

AngularJS: editing and saving is not working

I have created an application in angularjs with edit, save and cancel options, but the problem is that when i click the edit i am not getting the value for editing and saving. The textfield and ...
0
votes
1answer
18 views

how to pass varible from controller to directive using angularjs

i am writing click event in controller i.e in controller getting variables but i want to pass these variables into directive i am writing following sample code. sample.html: <div ...
0
votes
0answers
4 views

Testing directive link in angular js

I am testing following directive in angular Jasmine unit test angular.module('components.privileges', []) .directive('hasPrivilege', function(privileges) { return { link: function (scope, ...
-1
votes
1answer
24 views

about angularjs directive example

When I want to click on each level of the level below the UL expansion, the rest of the pack. Html code: <div class="main" ng-app="myApp" ng-controller="exampleCtrl"> <div ...
-1
votes
0answers
14 views

Angularjs assigning class in template not updating

So I have some code that attempts to create a calendar with alternating colors for months. Such as, colorA for a month and when the month changes then those days show as colorB, and when that changes ...
-1
votes
0answers
12 views

Override @page css style using angularjs directive

Hi I'm using angularjs to print different types of reports. I want some reports to have page numbers and others to not have it using @page in css. Since I only have one view file I cannot have ...
1
vote
1answer
14 views

Angularjs select default when loading remotely

I'm trying to have a default value in a SELECT element using angular, and it doesn't seem to be working. No matter what I do, it always selects a blank default element, when the data is loaded ...
0
votes
0answers
7 views

dirPagination does not work (Angular JS pagination)

I am trying to use dirPagination but it does not work. See my code in action: http://plnkr.co/edit/18BxNhHRNyRoI17sBGQF?p=preview My code: <!DOCTYPE html> <html ng-app="myApp"> ...
1
vote
1answer
27 views

Why are the blank options not being set for ng-options within a directive

I'm trying to create an AngularJS Directive to manage the promps of a <select> input. The 3 different modes are as follows: Don't allow a blank option This is the default behavior Allow a ...
1
vote
1answer
43 views

How can a directive wait for an element's dynamically interpolated attributes to be processed?

I have a directive called "connection" that draws a connecting line between two other divs given the ids of the divs. The ids are passed indirectly via some scope data. My "connection" directive ...
-1
votes
0answers
17 views

DOM focus method only called on reload, not on Angular route change

I have custom form directives, and an additional directive to give focus to the first input element in the template of the resulting element. module.directive("myInputFocus", [ function () { ...
0
votes
1answer
22 views

Get the HTML output from an Angular template in javascript

I have an angular template that I would like to be able to access the processed HTML from within a javascript function. If for example the template was under a templateUrl "/scheduler/tooltip.html" ...
0
votes
2answers
17 views

Submitting the form after changing value in Angular Directive submits old value

http://jsfiddle.net/p8RNJ/3/ When I press "submit" button, fooController in controller is equal to 'A' so barController gets assigned value 'A', which is confirmed in UI: bar in controller: A ...
-1
votes
0answers
32 views

how to delete option in each row in angular?

I make a demo in JQM in which I generate a row on button click .I give copy, delete , edit option in each row.Here is my fiddle http://jsfiddle.net/Palestinian/4ajeB/ Now I implement the same thing ...