Tagged Questions
1
vote
1answer
17 views
Cascading angular directives
I have the following Angular binding setup:
<div ng-repeat="app in vm.Apps">
<div ng-style="{ background: app.bgColour }">
<p app-shadow="large"></p>
...
0
votes
0answers
9 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">
...
0
votes
2answers
20 views
AngularJS: Refactoring a confirmation modal directive
I need some advice on refactoring a modal directive I have. I am just getting started with directives, so any other approach to my problem is welcome.
My program needs a confirmation modal, where we ...
1
vote
0answers
34 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
28 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
0answers
6 views
Angular ui-router's ui-sref created dynamically in a directive?
I am working on a line of business application that is using Angular to create a SPA around a Node.js api server. I decided on using ui-router cause of the state-machine and their intuitive way of ...
0
votes
1answer
22 views
How to refresh controller from a directive?
Here is the demo : http://plnkr.co/edit/atZZXM6YVYQL0SilpWxq?p=preview
In a table, I display each value of my collection, everything is fine. But when I remove one element in the list, the controller ...
0
votes
2answers
17 views
Modal popup in Angular JS without Bootstrap CSS
I'm looking for a plugin for a modal directive in Angular but there is a requirement not to use the Bootstrap CSS. Angular-UI looks nice but obviously depends on Bootstrap. Any pointers?
0
votes
1answer
16 views
Select Last HTML Select element from multiple select elements using AngularJs
Hello guys I am working on an application where I am using django-tastypie as backend and AngularJs for front end.I am totally new to AngularJs. In my template there may be multiple HTML tags based ...
0
votes
0answers
11 views
AngularJS Directive: Mimic ng-src behavior?
I'm integrating a media player in my app using the "Video For Everybody" generator. As the player features a fallback to flash if the browser doesn't support HTML5 video and audio I have to build ...
0
votes
2answers
20 views
Calculate mathematical expression within string in angularJS
How do I evaluate the mathematical expression within a string and assign it to a numerical value in angularJS?
Eg: var value = 10;
var someValue = "Math.min(value * 0.22, 106800)". I need someValue ...
0
votes
1answer
26 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 ...
0
votes
1answer
30 views
How do I check whether an expression attribute has been provided to a directive?
I've created a directive that accepts a callback as an attribute, e.g:
<my-directive callback-expression="someFunction()"> </my-directive>
The directive is reusable and hence I've given ...
1
vote
1answer
22 views
Recursive menu directive
I'm trying to do a recursive menu with angularJS, but I keep getting the fallowing error: Maximum call stack size exceeded
My directives:
angular.module("application").directive("navigation", ...
1
vote
1answer
38 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
20 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
14 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 ...
0
votes
0answers
21 views
Angularjs : Using a directive from within another directive's link function
In short, my question is how do I use a directive from inside another directive's link function?
Lets say I have a directive notification, whose main job is converting JSON data into a more ...
0
votes
1answer
16 views
Is the compile method appropriate for altering the template dynamically in a directive?
I have a directive where I want to add a select and either a textarea or an input field depending on some input. For example
app.directive('monkey', function() {
return {
restrict: 'E',
...
2
votes
0answers
27 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
2answers
24 views
How can I manipulate the DOM after my directive's content has been loaded on the page?
I am writing my own chat interface, to help me better understand angularJs and socket.io.
My chat window is fixed, with overflow set to auto. I am using the following directive to manipulate the DOM ...
0
votes
0answers
18 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
83 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 ...
2
votes
1answer
47 views
Isolated scope for directives
I'm having some troubles understanding isolated scopes in Angular directives. I've read the official documentation, watched a lot of videos about the subject, so now I'm know what's the purpose of ...
1
vote
1answer
39 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
0answers
20 views
How to send data from child directive to parent without shared services/factories?
I have two directives. One is an element and another one is an attribute.
<item attr></item>
How do I send data from attribute controller to the element controller. Note that a have a ...
0
votes
1answer
29 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 ...
0
votes
2answers
40 views
Using attribute text value in AngularJS directive
Using a YouTube tutorial created by John Lindquist, I was able to create a directive using a template. See fiddle: http://jsfiddle.net/37PSs/
Now, I want to use the value of the attribute as a ...
1
vote
1answer
32 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
2answers
42 views
Is scope.$parent.$emit() a good pratice to emit a event to parent scope ONLY?
Why I use scope.$parent().$emit() other than scope.$emit() is when the directive use scope:true and there's one more directive use scope:true, and they are placed at same DOM node.
Then ...
0
votes
0answers
8 views
Customising behaviour - toggle class- popover - Angular UI bootstrap
I'm wanting to add active classes to elements when various Angular UI directives are called. For example when I call the popover i'd like to highlight the element (which in this case is a button). I ...
0
votes
0answers
35 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
30 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
0answers
26 views
Why is angular routing resulting in invalid template urls?
Every example I have seen sets the templateUrl value without a starting /, which in my case results in a 404 for the second example listed below. Adding the '/' does fix the 404 for the template, but ...
1
vote
0answers
22 views
Bug in firefox when isolating scope in custom directive using angularjs
I have having some trouble with custom directives with angular and firefox.
This directive works perfectly on chrome :
.directive('card',function(){
return{
restrict: 'E',
...
0
votes
0answers
19 views
Dynamically pass controller and template to dialog in AngularJS (and test it)?
I am currently passing the controller and templateUrl by name, through my html-element, and to my modal-service. This is working fine, and I can test it. The problem is, I'm getting weird timing ...
0
votes
1answer
30 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
0answers
25 views
Cloning elements (bindings and all) in AngularJs
Is there a way to clone an element in AngularJS, with its bindings intact?
I am trying to create an image pre-loader for a gallery. The image loads off screen and is then moved into one of three ...
0
votes
0answers
25 views
AngularJS - Range slider doesn't work in ng-repeat (plugin)
I am trying to use this plugin in my project to have multiple range slider within ng-repeat. http://prajwalkman.github.io/angular-slider/
The plugin works fine when there is single slider , but when ...
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:
...
2
votes
1answer
56 views
Cannot test a directive that removes an HTML node element during $compile time
EDIT: it seems that the compile of the directive happens after the test has already failed.
Test:
I have provided a full mock of the service function that I need for my directive.
When running the ...
3
votes
2answers
38 views
Can an angular directive pass arguments to functions in expressions specified in the directive's attributes?
I have a form directive that uses a specified callback attribute with an isolate scope:
scope: { callback: '&' }
It sits inside an ng-repeat so the expression I pass in includes the id of the ...
0
votes
0answers
30 views
How to get the rendered html by AngularJS?
how to get the html rendered inside a div, after it is rendered and put it inside the scope of controller ?
I am new to angular and though i know the basics of directives i cant seem to get the ...
2
votes
1answer
33 views
autoscroll angularjs doesn't seem to work
Hi I'm building a chatapp in angularjs and I want the chatbox to scroll down automatically. I'm using this example that I put in a directive: http://jsfiddle.net/atRkJ/
It works as it is but when I ...
0
votes
2answers
43 views
What is the opposite of `ngDisabled`?
In AnguarJS, is there a directive that is the opposite of ngDisabled? So instead of writing:
<input ng-disabled="{expression}">
...
</input>
I can write:
<input ...
1
vote
0answers
26 views
Form Validation and fields added with $compile
I have a question regarding form validation. It is not working for me in the following scenario:
I have a global form, inside the form dynamic fields are rendered using a directive. That directive ...
0
votes
0answers
27 views
Dynamic value in ng-minlength
I have a constant called Config which contains a task.minlength = 3 attribute.
I'm appending the constant in the $rootScope:
.run(function($rootScope, Config) {
$rootScope.Config = Config;
})
...
-1
votes
0answers
38 views
Update ngModel on callback from FineUploader in Angular.js with ngModelController not working
i know this question have already been asked, but i have the exact same issues and the answer provided is not working for me.
link : Update ngModel on callback from FineUploader in Angular.js
I have a ...
0
votes
1answer
36 views
Angularjs custom directive highlight text after ng repeat has run
I want to create a directive that hightlights text( using jquery highlight plugin), after ngRepeat has rendered all its items. Consider following html:
<div data-hightlight="" ...
0
votes
1answer
45 views
Angularjs Directive - Isolated scope value is undefined
I am a newbie in angularjs. I am little confused about isolated scope in directives. I have the following code,
HTML
<!doctype html>
<html ng-app="myApp">
<body ...