Tagged Questions
0
votes
2answers
9 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
20 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
15 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
22 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
21 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
2answers
58 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
41 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
36 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
28 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
32 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
31 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
39 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
29 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
20 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
18 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
0answers
27 views
AngularJs switch focus when tabbing away
I was looking at this documentation on how to enable click to edit functionality in angular. I've modified the included fiddle to match my own case which uses enter and escape to save/cancel:
...
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
22 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
35 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
53 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
37 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
32 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
23 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
26 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
36 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
35 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
41 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 ...
0
votes
0answers
22 views
Autoscroll down angularjs
Hi I'm creating a chat app with angularjs that autoscrolls down when a user messages another user. I'm not sure how to implement this as my chat window is a fixed ul element. I'm thinking I will ...
0
votes
1answer
38 views
Creating a new html page from controller
I have an input form page, that when the user submits, it updates that page with some tables of data. If the user likes what they see, they should be able to print a cleaned up (no header nav, footer ...
-1
votes
1answer
28 views
AngularJS Tree Directive Recursive Errors
I'm implementing angular-bootstrap-nav-tree directive in my application inside of a partial. When I do the most basic example I get:
TypeError: Converting circular structure to JSON
at ...
0
votes
0answers
6 views
$httpBackend prevents normal angular routing; how do I configure $httpBackend to allow normal routing behavior?
I need to load up $httpBackend in order to mock out $http server calls (which return JSON). I've defined my own mocks, but when I load up my angular app with $httpBackend and my own mocks, I get an ...
0
votes
3answers
53 views
AngularJS Directive Numeric Format Masking
The directive I have created uses the function setFormatting to mask the text value in an input field.
scope.$watch(element, function() {
modelCtrl.$setViewValue(setFormatting(element.val(), ...
0
votes
1answer
20 views
Reset the scope using an onclick event with AngularJS
I have a scope variable that gets set when a user clicks an element. I would simply like to change that variable to false when a user clicks outside the element. Common convention for modals or popup ...
0
votes
2answers
39 views
Talking to Angular Directive from Controller
I have a directive and I want to call a method of the Directive from outside controller . That means when I click a button in the main controller , I want to hide a component in the directive . Is ...
0
votes
1answer
23 views
Angularjs directive clicking elements
Hi I was wondering when I have a list of elements from a ng-repeat, how I can allow the user to click one of the list and make it highlight via .css(). Then if the user clicks another element, the ...
1
vote
2answers
57 views
Angularjs isolates scope directive with ng-repeat
I'm trying to use directive on ng-repeat items each with an isolate scope but it isn't working. I'm looping through each item and coloring it red with the inboxuser-select directive. However, when I ...
1
vote
2answers
40 views
Why ng-hide doesn't work with custom directives?
I'm reading the directives section of the developers guide on angularjs.org to refresh my knowledge and gain some insights and I was trying to run one of the examples but the directive ng-hide is not ...
0
votes
1answer
31 views
Unable to print scope variable inside ng-repeat
I am trying to associate id inside an ng-repeat loop. Can someone suggest how can i do this?
here is the code
<li ng-repeat="agent in agents">
<chart ...
0
votes
0answers
17 views
Not able to debug in firefox when using $timeout in directive
When I am debugging in firefox and debugger is supposed to enter the directive :
dialogApp.directive('myTable', function($timeout) {
return function(scope, element, attrs) {
$timeout(function(){
...
1
vote
0answers
27 views
Passing an angular format expression to a custom directive attribute
In an effort to wrap my head around AngularJS directives I'm trying to build a custom HTML table out of an arbitrary JSON array of data passed to my custom directives; specifying a header and a ...
-1
votes
1answer
25 views
AngularJS: Trying to programatically add directives to a view
Here is my plunk: http://plnkr.co/edit/BGD0n6gmDM3kv5akIn4l?p=info
I am trying to make a view factory of sort. Ideally my controller will place a config object into scope that the view will use to ...
0
votes
3answers
46 views
angularJS: wait for template to be evaluated before directive loads
The Situation
Lets say I have a directive, that has to access certain elements via ID, inside the element on which the directive is defined. The problem, that can occur, is that by the time the ...