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.
0
votes
1answer
22 views
replace element in angularjs directive linking function
I'm creating a <row> AngularJS directive that needs to replace itself (the <row> tag must not be present in the DOM after execution) with a dynamic template that can contain any HTML code.
...
0
votes
0answers
16 views
Fastest dynamic creation of controls?
At the moment I use this code to build dynamic controls
app.directive('viewer', function ($compile) {
var nameTemplateCtr = '<span>{{value}}</span>';
var ...
0
votes
0answers
6 views
Get validity in Unit test of Angular JS directive
I'm unit testing my directive and doing it like this:
describe("myDate", function() {
var $compile, $rootScope;
var validDate, invalidDate, invalidDateFormat, element;
...
0
votes
1answer
17 views
Passing variables to embedded directives
I have a directive mydiv which embeds another directive myspan inside it. So my index.html looks like:
<mydiv></mydiv>
and the template for mydiv looks like:
<div>
...
0
votes
1answer
25 views
Delayed compilation of hidden elements in angular.js
I have a fairly complex angular.js app that has a "show" mode and an "edit" mode on the same page. Most of the complexity is in the edit mode, and most users won't ever be in "edit" mode.
You can ...
0
votes
0answers
32 views
Why is angular.js not smart enough to compile DOM when adding dynamic elements?
I really like how AngularJS enables custom tags/elements by allowing you to declare directives inside your app, however, when I append a custom tag dynamically, nothing happens:
...
0
votes
0answers
29 views
Get ng-repeat complete in angular directive
In the code below, how does the angular directive 'myscroll' know what ng-repeat elements are being created?
<myscroll>
<div ng-repeat="a in arr">{{a}}</div>
</myscroll>
...
0
votes
2answers
30 views
Why is angular not updating my model
In my (table) overview I have custom directive. This directive shows customer details and contains an edit button. When this button is clicked a edit form pops up. When I change values of the customer ...
0
votes
0answers
41 views
AngularJS directive - grouping <td> elements
I want to do a directive which appends "grouped" <td> elements based on array in controller,
I try do it like so:
App.directive("discount", ['$compile', ($compile) ->
restrict: 'A'
scope:
...
0
votes
1answer
23 views
Specific directive (AngularJS) or some template loading before all scripts get content
I have a script when the page loads:
200 OK
45ms
angular.min.js (line 100)
/customers/create.form.tpl
200 OK
44ms
angular.min.js (line 100)
...
3
votes
2answers
55 views
How to deal with race conditions in javascript?
First off all, I'm a pythonist, not a javascripter - please be kind.
In a popular MVVM Javascript framework from a popular Internet search provider, there is a class called Scope.
This class has a ...
1
vote
0answers
46 views
How to replace (or extend) vanila Angular directive?
I wonder is there a way to extend vanila directive by HTML that will be wrapped around input.
Basically I want Angular to compile
<input type='checkbox'>
into
<div ...
1
vote
1answer
40 views
AngularJS ngModelController basic questions
In the Angular documentation in the ngModelController example, the javascript file says:
angular.module('customControl', []).
directive('contenteditable', function() {
return {
...
0
votes
1answer
20 views
A directive inside a directive
Working on a directive to highlight <code> tags that are being outputted by a directive to render <markdown> tags.
The problem is that the <code> directive is never hit after the ...
0
votes
1answer
26 views
Angularjs: validation not working when control is based on directive
Being rather new to Angularjs, I am creating textbox-label combinations in Angularjs using directives. It's working very well, but I can't get validation to work. Here is a stripped-down example.
...
0
votes
0answers
43 views
AngularJS directives and observe attributes
I have the directive that used under ng-repeat. And everithing works fine, before I use this directive OUTSIDE the ng-repeat: {{placeholders}} aren`t data filled.
Please help me find what the ...
0
votes
0answers
18 views
angularjs / requirejs boilerplate and custom directive problems
I'm playing around with Angular and the awesome angular-requirejs-boilerplate-seed, which is great. I can't seem to figure out the proper way to create a custum directive module though, so any help ...
0
votes
1answer
26 views
Debugging AngularJS Databinding Inline Directive vs Directive in ngTemplate
Take a look at this fiddle: http://jsfiddle.net/ADukg/3036/
I have two directives that are using two-way databinding on a value provided by the same controller instance. When the directives are ...
-2
votes
0answers
27 views
ng-repeat in multiselect-dropdown directive not displayed
Help me. My ng-repeat set in < select multiselect-dropdown > ... < /select > is not displayed :( http://plnkr.co/edit/NGQZmW?p=preview
(I create directive multiselect-dropdown from library ...
0
votes
0answers
50 views
Why is my input type date value not set using Angular?
I have this HTML:
<input type="date" date="MM-dd-yyyy" required data-ng-model="customerFormData.customer.BirthDate" />
And this is my directive (from this fiddle of P. Kozlowski)
...
0
votes
1answer
13 views
angular - reusable view with different filters
I have a view that just displays a list of products.
<ul>
<li class="cf" ng-repeat="item in sportProducts">
<img src="productImg.png" width="36" ...
0
votes
0answers
17 views
Jasmine-jquery, testing generated GUI for (nested) directives
I recently started using jasmine-jquery (1.3.1) together with angular (1.0.6) and need an advice on testing GUI.
I have some view for controller, which has angular directives, like 'view.html':
...
-1
votes
1answer
26 views
ng-change executing before ng-model is set for a <select>
I have the following html and js
<select ng-change="setBillGroup()" ng-model="bill.groupId" class="span8" ng-options="d.id as d.name for d in groups"></select>
and the corresponding js ...
1
vote
1answer
49 views
Why won't this angular JS resource fire in an event?
I have an object that contains a resource. When I use this resource to make requests in most parts of an application, and it works fine. However, inside of a function that gets called due to an event ...
0
votes
1answer
24 views
AngularJS and dojox.charting - 'nodeType' of null"
I am attempting to populate a repeating (ng-repeat) div with different graphs from Dojo based on the current data model.
When my code runs I get the error "Cannot read property 'nodeType' of null"
...
0
votes
1answer
25 views
Fix disconnect between model and view in AngularJS after unbinding
I managed to change the default on the fly validation of AngularJS to a validation onblur and on submit with help from the stackoverflow community: Trigger validation of all fields in Angular Form ...
1
vote
2answers
126 views
AngularJS: Why and when calling $timeout is required?
Live Demo
I created a confirmationDialogHeader directive which is used like so:
<ul>
<li ng-repeat="item in items">
{{item}}
<button class="btn btn-mini"
...
0
votes
1answer
30 views
How to get template output content into a variable in Angular directive
I'm trying to get template output (pure html) into a variable inside an angular directive and attach it to the model.
I couldn't find anything related in their docs. This is my code:
myAppDirectives
...
1
vote
1answer
40 views
AngularJS intercept links on dynamic content
I know this is probably a non angular way of doing things but I can't think of a good way without having to rewrite a lot of how the content is laid out. This is also my first angular app and it's ...
0
votes
2answers
46 views
Angular UI Bootstrap Modal use in directive
I would like to create a confirmation-dialog-header directive that will open a Bootstrap UI Modal that will be used like this:
<button class="btn" confirmation-dialog-header="Non Working ...
1
vote
2answers
44 views
Passing variable to directive's attribute
In AngularJS, how can I use a variable within an attribute of a directive?
Without any directives, this work fine:
<a
href="#/fruits/{{ fruit.short }}/details"
title="Back to Fruit ...
2
votes
2answers
60 views
Extending Angular Directive
I'd like to make a minor modification to a 3rd party directive (specifically Angular UI Bootstrap). I simply want to add to the scope of the pane directive:
angular.module('ui.bootstrap.tabs', [])
...
2
votes
1answer
35 views
Angular.js scope not updating in directive
I have an Angular.js directive that needs an isolate scope plus access to the $parent scope. The parent scope has data which changes after an ajax call completes.
In my directive's linking function, ...
0
votes
1answer
29 views
Angular directives not rendering as expected
I am experimenting with directives in angular and I'm puzzled.
http://jsfiddle.net/S2cQD/2/
I have four directives: person, personWholeName, personFirstName, and personLastName. person calls the ...
1
vote
2answers
43 views
How can I dynamically set the background-image on each DIV using ngRepeat and ngClass?
I would like to be able to set the background-image property of each div that is created during ng-repeat.
I tried to use ng-class to add the appropriate class to the appropriate div in the ...
-1
votes
0answers
41 views
Breadcrumbs in Angular
I want to use Angular's breadcrumb capability. I added this javascript file to my services folder.
I added a div to my header.html file to call the javascript. According to Angular, the div should ...
0
votes
1answer
35 views
Modifying a Shared Variable Between Multiple AngularJS Directives
I have created this jsfiddle:
http://jsfiddle.net/noahgoodrich/CDwfL/1/
I have created a set of directives to manage and manipulate navigational tabs. For some reason, when I try to close a tab, it ...
1
vote
1answer
36 views
Generic looping directive, does one exist?
We have some data that looks like this:
[{id: 1, link: "foo"}, {id: 2, link: "bar"}, ..., {id:n, link:"nth"}]
And we want to generate some output like this:
<ul>
<li>id is: 1</li>
...
0
votes
1answer
59 views
How can I turn this into an AngularJs Directive?
I have a select list that I am populating with ng-options. It also has a "default" selected item that kind of acts like a "placeholder" since lists don't have an actual "placeholder" attribute.
...
0
votes
0answers
37 views
AngularJS Dynamic Routes
So I've been working on a directive to add named routes to angular.
It almost works, but for some reason the link title isn't working now. the {{ page.title }} between the opening and closing anchor ...
1
vote
2answers
24 views
Parameter elem of the linking function
I've got the following directive:
.directive('confirmOnExit', function () {
return {link: function ($scope, elem, attrs) {
window.onbeforeunload = function () {
if ...
2
votes
1answer
37 views
Access the compiled template in a directive
If I do elm.html() in the link function then I get the uncompiled template with {{curly_brackets}}. How do I get access to the compiled html where the {{template_variables}} have been replaced by the ...
0
votes
3answers
70 views
Angular custom directive with filter in attribute
I would like make angular directive where I use filter on data which are passed as argument.
So something like this:
<div class="my-module" data="a in array | orFilter:filter"></div>
...
0
votes
1answer
81 views
AngularJS - accessing directive scope
So, I'm looking to use ui.bootstrap.tooltip to appear when an element in a form is invalid.
I'm using a directive to do this - it's a bit ugly, but it works. Except for one thing - the controller ...
1
vote
2answers
46 views
angularjs confusion over directives and models
Am I doing this right ? My scope had some json assigned to it from a controller. I'm iterating thru it using the angularForEach.
I'd like to be able format my td data to be dates. This is a trivial ...
1
vote
0answers
29 views
$sanitize Custom Whitelist
The $sanitize service tells me that
All safe tokens (from a whitelist) are then serialized back to
properly escaped html string.
I want to only display an even smaller subset of HTML (viz ...
0
votes
1answer
26 views
Nested directive, child don't “transclude” correctly
Here is what I'm trying to do: http://jsfiddle.net/Dtg3N/
'use strict';
var navbar = angular.module('navbarApp', []);
navbar.directive('navbar', function () {
return {
restrict: 'E',
...
1
vote
1answer
35 views
Instantiating child directives in AngularJS
I'm having trouble figuring out how to programmatically instantiate directives. For example, in the tabbed panels example, suppose I want to have a function to "Add a new tab" in the parent tabs ...
0
votes
2answers
88 views
Angular directive data binding not working properly
I have been trying to write a shared directive for my angular apps that turns an input field into jquery timepicker.
I have two input fields, fromTime and toTime, and I want to update the toTime when ...
0
votes
1answer
20 views
Directive that creates child scope in AngularJS
When creating complex forms I found the need of separating some parts of my view into different child scopes to be able to have individual visual properties.
The good example could be implementing ...