0
votes
2answers
22 views

Angularjs two way data-binding for form data POST

Using angularjs, I am trying to populate a form dynamically and then submit the forms data via POST to a server. I created a data variable in my controller (to POST later) $scope.data = {}; Then ...
1
vote
1answer
26 views

Call controller function from angular directive

How can I call angular function inside directive which is defined in controller? var app = angular.module('myApp', ['ngResource']); app.directive('hello', function () { return { scope: { ...
0
votes
1answer
11 views

Element unspecific AngularJS directive template

I'm developing UI and typography based directives for Angular. In such cases, the element the directive is being applied on is unknown - anything from a div, span, h1 to an h5. The reason for using a ...
0
votes
1answer
20 views

Angular Directive - Nested Object in Attr

There is great solution provided for this question, that shows how to use a directive to display <tr>'s for nested objects. However, I need to take it a step further and pass a nested object ...
0
votes
1answer
19 views

Destroying child directive scope

In my application i've created two directives, one parentDirective and childDirective.The parent directive dynamically creates child directives depending on some criteria defined in parent on button ...
0
votes
1answer
32 views

AngularJS - hide a div when clicking in an inner element using a directive

I'm trying to hide a box when clicking on a link inside this box. I wan't to use a directive to be able to add more code when once the box is hiden and to keep it generic so I can use that with other ...
0
votes
2answers
21 views

AngularJs ng-if for displaying or skipping on element

I am using AngularJS. I have the following template: <div> ... html content .... </div> I want to wrap the html content with an anchor only if the url model is not empty. For ...
2
votes
2answers
41 views

Angular js - Highlight dom when value changes

Angular noobie here. I would like to know what is the best way to change the dom when a value in the scope changes by some means. I read that its not good to put the dom manipulation logic in the ...
0
votes
0answers
16 views

AngularJS and Flexslider loading

How can I get Flexslider to fire once all my API images have loaded? The problem is that Flexslider fires before Angular can pass in the large images I'm retrieving from an API. If I refresh a ...
1
vote
1answer
27 views

AngularJS Sharing Directive Scopes and Iterating Over Values

I am trying to create a directive who gets it values from a child directive and that populates the fields in the view. An example: app.directive('directive1',function() { return { ...
0
votes
0answers
24 views

How to expand a tree in javascript which is generated using a recursive directive in Angular?

I build a tree using a recursive directive: app.directive('recursiveListItem', ['$http', 'RecursionHelper', function ($http, RecursionHelper) { return { restrict: 'E', scope: { ...
0
votes
0answers
30 views

AngularJS - Form validation, how to scroll to first invalid input

I want to scroll document to first invalid input in the form on button click (without using jquery of course). What a proper (angular-way) approach for this situation? Thanks.
0
votes
1answer
24 views

Angular directive works on an element in the first page but stop working after navigation (probably a scope issue)

the directive code directive('stFloatBar', function($log,$window){ return{ restrict:'A', replace:true, transclude:true, ...
0
votes
1answer
25 views

How do I inject a directive template based on an option selected from a dropdown

Here is my html: <html ng-app="myApp"> <div id="inputPane" ng-controller="MyInput"> <select ng-model="dataSource" ng-options="data.Name for data in dataSources"> ...
0
votes
1answer
19 views

Binding angular scope inside a fancybox not working as expected

I created an angular directive to work with fancybox and it partially works. Check out the plunker The data binding works ok, if I change a variable outside the fancybox and then open the fancybox ...
0
votes
2answers
34 views

AngularJS directive - complex directive name

We started to use the AngularJS in the project that supposed to be large and decided to use "modular" project structure and naming conventions. Everything is works good, except directives. Our ...
0
votes
1answer
29 views

Passing an object to a directive as an argument

I have a view and a controller for it: <app-head options="options"></app-head> app.controller('homeCtrl',function($scope){ $scope.options = { first: { description: "A ...
0
votes
0answers
28 views

angularjs: how does the replace attribute works for directive ?

I'm trying to figure out how the 'replace' attribute work for directive. I've run into a scenario when setting it to true was causing my code to break. The directive: ...
1
vote
4answers
70 views

AngularJS directive gets not updated if scope variable changes

I've tried to write a small directive, to wrap its contents with another template file. This code: <layout name="Default">My cool content</layout> Should have this output: <div ...
0
votes
2answers
42 views

Best practise: Wrap a template in another template in AngularJS?

I am trying to do the following: I have a recurring UI pattern called <overlay></overlay> This overlay is dynamically created by a directive dir1 from a templateUrl. Let's assume now I ...
1
vote
2answers
42 views

How to define a function inside Angular-js Directive

I created a directive for selecting users using bootstrap's drop-down element. as follows. Javascript app.directive('usersDropdown', function(ConfigService,$http) { return { templateUrl: ...
3
votes
2answers
80 views

Angular JS: How to set an iframe src attribute from a variable

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=""> ...
0
votes
0answers
59 views

Get original transcluded content in Angular directive

Is it possible to programmatically get the original transcluded content within an Angular.js directive? I'm trying to create an an editable directive which can be added to any div, allowing the user ...
6
votes
2answers
138 views

AngularJS: What is the need of the directive's link function when we already had directive's controller with scope?

I need to perform some operations on scope and the template. It seems that I can do that in either link function or the controller function ( since both have access to the scope ) When is it the case ...
0
votes
1answer
30 views

Using ng-model and ng-repeat within a directive

So I can't seem to quite figure this out. Basically, I am building a directive which consists of options, and I want to define those options in the directive, but define the default option in my ...
1
vote
1answer
43 views

AngularJS + Coffeescript - 'Hello World' directive not working

I can't make the simplest of directives work in my AngularJS + Coffeescript project. I have this code in directives.coffee: 'use strict' app_name = "myApp" app = angular.module ...
0
votes
0answers
38 views

Add bootstrap popup behavior after AngularJS apply is done

I'm working on a timetable in angular JS with 3 years and 4 quarters per year. Users can drag courses into the timetable and need to see a warning in case there are too many courses in the quarter. ...
0
votes
0answers
37 views

Custom AngularJS attribute inside the directive with HTML page template

I want to create two directives: one of them should be an simple tag and another one should be an attribute for this tag. Another words I want to make something like this: <outer ...
1
vote
2answers
61 views

Strange behavior of nested Angular directives

I want to use my directives within other directives. The following example gives so strange results that I had to give up and ask this question. I would like someone to explain me what is going on ...
2
votes
1answer
33 views

AngularJS: How to map object to HTML attributes

let me describe what I am trying to do. I am building a really dynamic ng directive to build table based on data array and config object provided. What I want to know is how to assign attributes ...
2
votes
1answer
35 views

Using ng-transclude inside ng-switch

I'm having trouble getting ng-transclude to work within an ng-switch-default directive. Here's my code: Directive: .directive('field', ['$compile', function($complile) { return { ...
0
votes
0answers
13 views

Directive with asynchronous compile transcluded into another directive

I know this is a bit of an edge case but I have an directive with a compile function whose compile step is asynchronous*, when it is transcluded into an outer directive with transclude: true, the ...
2
votes
2answers
66 views

Dynamic tag with angularjs directive

I would like to create an element directive in angularjs that produces an html element from a json blob passed as an attribute. I have tried quite a few variations of the following... ...
0
votes
0answers
18 views

Linking and controller function of directive which is represented as an attribute of another directive don't work

Have the following problem. I want to make two directives. One of them will be an attribute for another. Something like this. <html> <title>Directives</title> <head lang="en"> ...
3
votes
1answer
120 views

angular.js directive templateUrl fails to bind scope

I'm creating a directive that will display and show content by listening to the $routeChangeError event on $rootScope. I got it all to work by inlining the template like this: app.directive("alert", ...
1
vote
3answers
39 views

Why is this Angular model not completely overwritten?

I'm encountering a strange issue where a model is not completely overwritten after a new property has been set on it in a directive. HTML: <div ng-app="app"> <div ...
0
votes
1answer
30 views

Angularjs creating questionaire that allows ranking choices

I'm creating a questionaire for users that allow them to choose and rank personality attributes that best match them. There are three choices in each row and everytime they click on a choice it ...
1
vote
1answer
75 views

Recursion using Angularjs and Append Elemnts to an HTML Template

I am quite new to Angularjs . I am working on an app which use Angularjs for front end and django-tastypie for back end. What I am doing is i have a topics list where topics are nested in each others ...
0
votes
1answer
24 views

Applying math rules (like rnd, max etc) to value entered by user using AngularJS directive

I have sum calculation rules defined as below, where 2013 represents the year and 5 and 6 are some codes sent over to the program: app.run(function($rootScope) { $rootScope.MATHRULES = { ...
0
votes
2answers
20 views

Why does changes to the outer scope from within a directive require scope.$apply() even if I am setting scope option to false?

Lately I've noticed that changed to some angular - provider objects, or to my own - outer scope(out side of the directive, in the controllers) required wrapping the code in scope.apply(). can anyone ...
2
votes
1answer
66 views

Access a div color-picker element through form controller

I am using this library in order to add a color picker feature to my AngularJS app. I would like to allow my client to use a color, which will then appear before him as small square div, with rounded ...
0
votes
0answers
20 views

angular dynamic templating directives

I have a list of different field types and I want to apply a template based on type. I can get it to work if I use inline templates like this: flowPageModule.directive('myField', ['$compile','$http', ...
5
votes
3answers
200 views

AngularJS Scope difference 1.0.x vs 1.2.x

As of the release of the next stable AngularJS, I am migrating my application from version 1.0.8 to 1.2. In AngularJS 1.0.8 it was possible to set up an isolated scope for directives like follow. The ...
1
vote
0answers
46 views

Format <input> to display currency as user types

I'm looking for a way to format an input element to format for currency. Specifically I want the commas in there for thousands. The initial solution was to just format the value in the controller and ...
0
votes
1answer
41 views

AngularJS Directive: link objects in collection with transclude/compile

One of my pages needs to load an SVG file then edit it. Right now it is a huge directive that handles both the SVG as a whole, as well as every interaction tied to the shapes. I would like to split it ...
1
vote
1answer
41 views

AngularJS Directive - Receiving a broadcast from $rootscope

I have the following code, HTML <div ng-app="test"> <div ng-controller="containerCtrl"> <component data-module="components"></component> </div> ...
0
votes
0answers
36 views

Two directives use true scope , one is parent of the other , why?

This is Plunkhttp://plnkr.co/edit/MlsOkwcrrHc2fnvZrWPI?p=preview. (please ignore test and amp directives, they are useless) CLOSED Reason for closing this question: I add more log and add variable ...
0
votes
0answers
31 views

How to correctly work with custom attributes inside a directive

I would like to create a directive which simplifies the work with tables for an application of mine. Do i understand correctly that custom data-attributes (e.g table-headings) are the way to go when ...
0
votes
1answer
31 views

Directive should take data from template OR from controller

I am new in angularjs. I have a directive that shows countdown to endDate. Everything works fine with a hardcoded value: var endDate = new Date("2013-11-26T10:00:00Z"); But I can not manage how to ...
0
votes
2answers
36 views

Angular - create a directive based on a model

Is it possible to turn this [{ compType: "special-label", style: { left: 10, top: 10 }, { compType: "special-image", style: { left: 10, top: 10 } ] into this: ...

15 30 50 per page