Tagged Questions
0
votes
1answer
9 views
Why isolate scope “@” and $apply don't work as expected
I've been studying AngularJS and in particular saw the video:
http://www.thinkster.io/pick/IgQdYAAt9V/angularjs-directives-talking-to-controllers
This video presents an example of a directive ...
1
vote
1answer
71 views
Scope Variable Not Being Set Outside of Directive
I am attempting to create an AngularJS directive that sends a file name, from an <input type="file"> element, to a file upload factory. The work is based off the following blog post:
...
0
votes
0answers
67 views
Nested directives - cannot pass args to controller method from child directive in Angularjs
I'm having some trouble with nested directives in angularjs. I want to call a controller method from a directive within another directive and am trying to pass arguments to it, however they are ...
0
votes
1answer
59 views
prevent default on submit :- Angularjs
I want to prevent-default action of http-post to '/signUp' if e-mail is null upon filling form.
Controller Code:-
$scope.signUp = function() {
if($scope.email = null);
preventdefault;
}
...
0
votes
1answer
17 views
How to bind a transcluded template to a different controller?
I'm trying to pass a template through a directive to a dynamic controller (known at runtime from the directive perspective).
Something like this:
<my-dir ctrl="PersonCtrl">
...
0
votes
2answers
109 views
access parent directive's controller by require: '?^…' recursively
I'm trying to reach the controller of a parent "box" directive recursively:
<body ng-app="main">
<!-- no nesting: parent is the just body -->
<box></box>
<script ...
1
vote
1answer
29 views
Communication from Diretives to Controller in Angularjs
I am new to angularjs. I have following code , Now i want to access object of map in controller. here i am not able to know, how to pass it to controller?
My Custom Directive :
...
1
vote
1answer
115 views
Pass Arguments from directive to controller function
I've seen lots of these questions but haven't found a solution that works. here is a fiddle that doesn't work but should.
http://jsfiddle.net/cdparmeter/j2K7N/2/
Controller:
$scope.foo = function ...
3
votes
0answers
41 views
The difference between a compile/link function and a controller function in AngularJS? [duplicate]
I'm trying to write my own AngularJS directives. I think I understand the difference between the compile and link functions. This video clears it up nicely.
But I'm not sure now that I understand the ...
2
votes
2answers
48 views
AngularJS Directives and the Model
I'm not sure this question's been asked, but is it good practice (not ok-to-do) to mess with the data model from an AngularJS directive?
For instance, if in my controller I have some object, like:
...
0
votes
1answer
68 views
Angular access controller scope from nested directive
this fiddle represents what i am trying to do:
http://jsfiddle.net/d1001001/dwqw6/.
The grid directive needs to grab some data from controller, but since it's nested in the modal directive, which has ...
0
votes
1answer
198 views
AngularJS - Pass variable from a controller & update from directive
I've set one Plnkr. I want to dynamically add input fields in a directive. The input fields are to be built by a collection from a controller. And change the values of the inputs. But the main problem ...
0
votes
2answers
160 views
How to connect my controller in my directive for inserting data and adding bootstrap select in angular.js?
I'm trying to add data on my select menu using a controller and used ng-options while i have a class defined in my directive to insert the bootstrap-select plugin to the element. The problem is that ...
0
votes
0answers
60 views
How to have page controller execute directive functionality AngularJS
Lets say I have a directive that has an isolate scope and that scope have a method on it. Now is there an Angular way to allow the page controller to be able to call functionality declared in a ...
1
vote
1answer
768 views
Jquery animation in a AngularJS controller or directive?
I have an app in AngularJS and in one of my view I want to implement some JQuery animation..nothing too fancy..just hide/slide of a divs ..those divs are created from ng-reapet loop and I need access ...
0
votes
0answers
207 views
AngularJS - Create a directive to fire an event (function) when the current element is appended to the DOM
I am trying to find a way to detect when an element is finally appended to DOM? Is there any directive that I can create and attach to that element so it will detect the moment of appending? By ...
0
votes
1answer
644 views
AngularJS - How do I avoid using $timeout to wait for an element to be created?
Here is the idea:
So I am trying to use an external library function to create some manipulation in the DOM in one of my controllers that my ng-repeat is connected to.
Newest jsFiddle working but ...
0
votes
1answer
155 views
Angular using another directive's controller?
If I have two directives, and need to have one of them use the controller of the other one, what is the best way to accomplish something like that in angular? I'm trying to use the require: ...
1
vote
1answer
65 views
AngularJS: How to set controller's property from a directive when using the “Controller As” syntax?
LIVE DEMO
Consider the following example that uses the Controller As syntax:
<body ng-app="myApp" ng-controller="MyCtrl as my">
<div>
{{ my.message }}
</div>
<button ...
0
votes
0answers
193 views
angular ui-select2: fire highlight events programmatically (without using JQuery)
is there a way to call highlight events of select2 in a programmatic way?
something like "ng-highlight"... that will enable writing the callback function of the item-hover in the controller.
...
0
votes
1answer
41 views
Angularjs two separate ui elements communicating
I have a use case to toggle the view of a form using a button. The button is not nested in the same structure of the form, and is out side the scope of the forms controller.
What is the best way to ...
5
votes
1answer
2k views
Sharing data between AngularJS controllers? [duplicate]
How do I store the items I've selected in a checkbox with other controllers?
My attempt (see the plnkr for views):
script.js (controllers)
var myApp = angular.module('myApp', []);
...
3
votes
3answers
5k views
Simple Angular $routeProvider resolve test. What is wrong with this code?
I have created a simple Angular JS $routeProvider resolve test application. It gives the following error:
Error: Unknown provider: dataProvider <- data
I would appreciate it if someone could ...
0
votes
1answer
952 views
Angular JS delay controller and directive initialization until data is returned from server
My AngularJS app requires some metadata from the server before it can initialize the controller and a handful of directives. I have a service to return the data but have been unable to get the ...
1
vote
2answers
235 views
Angularjs: models binding
I have directive which dynamically creates input tags. I need to get values of created inputs on change event. Instead of it the name attribute on $scope argument in the controller is undefined. How ...
2
votes
3answers
2k views
Angular communication between controllers and directives
I have this piece of code which allows a user to leave comments on a list of items.
I created a directive and listen to keydown in order to let the user submit a comment if keyCode == 13.
Not sure ...
1
vote
1answer
1k views
AngularJS The scope for dynamic content through $compile isn't attached to the controller scope
When I generate a new element through a string that has a directive (that's why I need to compile) and that directive generates an association with a variable in the controller scope through "=", the ...
-1
votes
1answer
538 views
AngularJS how to pass data from one controller to different directives [closed]
I am not sure whether I can do like this or there is a better way. I need someone to guide me.
I created two template using directive (both directives in the same page).
Let say
directiveVideo for ...