All Questions
Tagged with angularjs-controlleras angularjs-directive
22 questions
0
votes
2
answers
91
views
Call angularjs directive function from controller
I've got a directive that needs to do something every now and then, let's say it has to count something.
If I use the basic syntax with $scope to bind the count function, it works just fine. but when ...
1
vote
0
answers
27
views
AngularJS scope is passed to directive after directive's factory function exits [duplicate]
I'm trying to upgrade an AngularJS template we're using to its latest version.
Now, this template upgraded to AngularJS 1.6.9.
But now, after i've upgraded, i'm experiencing a problem that the vm ...
0
votes
2
answers
499
views
angular directive controller doesn't see passed parameters update
I have problems using controllerAs in angular directive. When the data is passed to the directive as parameter i want to do some simple transformation and pass it down to child directive. On ...
1
vote
1
answer
414
views
angular directive with controllerAs dosn't work
I'm struggling with making angular directive work with controllerAs. When using $scope everything work as expected but when get rid of $scope directive controller doesn't work. Please see the code ...
1
vote
1
answer
96
views
Accessing controller from compile function in directives
I have searched all over and the only thing I can come up with is that I don't understand something fundamental about how the compile function works.
Here is what I have
angular.module("app", [])
....
0
votes
1
answer
855
views
Directive Parameter Not Initializing on First Load In AngularJs
I'va made a Dropdown directive, i'm trying to assign methods on passing parameter to directive and i'll call these method from controller.
but on first load i'm not getting the assign method in ...
1
vote
0
answers
72
views
How to update a variable in controller (ControllerAs syntax) from directive in Angularjs?
I have a dropzone directive:
function dropzone() {
return {
restrict: 'C',
link: function(scope, element, attrs) {
var config = {
url: 'http://192.168....
1
vote
2
answers
3k
views
How to access directive's controller variables in directive's template?
Need to use variable (defined inside the controller element of directive) in the template element.
angular.module('home').directive('mediaTile', function(){
return {
restrict: "AE",
...
0
votes
1
answer
1k
views
Multiple directives in same element operating on visibility
I have been struggling with my approach for the following scenario.
I have a custom directive authorize where I pass the name of a group. If the current user has this group in his profile then the ...
1
vote
1
answer
467
views
Directive with it's own controller placed within ngAnimateSwap results in new controller being initialized on every 'swap'
I have created a directive (ParentDir) that has it's own controller and whose template binds to this controller. It communicates with another directive (Child1) that has it's own controller which '...
0
votes
2
answers
196
views
Have a dynamic html element using AngularJS Directive WHITOUT $scope?
I want to use This Plunker sample code to add some elements dynamically to HTML page using AngularJS. (You should run It in a new link, not in editor environment) This is my first experience in ...
1
vote
1
answer
548
views
Two way isolated binding angular directives es6
I am having trouble figuring out how isolating scopes work. My code seems to work fine when i comment the scope part of the directive. Can anyone explain what I'm missing?
export function ...
4
votes
1
answer
4k
views
Angular - Directive with controllerAs, bindToController, and $scope.$watch
I have a fairly straightforward AngularJS question to which I cannot seem to find an answer:
How would I go about using $scope.$watch() in a directive controller while also using the controllerAs and ...
1
vote
1
answer
808
views
angular directive controlleras and link
I have markup like this
<i class="fa-font icon-user" wd-user-profile></i>
to show / hide this div
<div id="user-profile" ng-show="vm.isVisible">
<h3>user name</h3>
&...
0
votes
1
answer
196
views
How to use a controllerAs syntax within a directive template in AngularJS
Here is my controller:
angular
.module('app')
.controller('MyCtrl', MyCtrl);
Viewer.$inject = [];
function MyCtrl() {
var vm = this;
vm.titles = ['Hello', 'world'];
}
My Directive:
...