Thank you very much...
I have one more question regarding to directives. Let's say that I'm having
something like this:
var app = angular.module("app", []);
app.controller("controller", function ($scope) {
$scope.myClass = "class1";
});
app.directive("myDirective", function () {
return {
restrict: "AEC",
replace: true,
template: "<div ng-class='myClass'></div>",
link: function ($scope, elem, attrs) {
elem.bind("click", function () {
$scope.myClass = "class2";
});
}
}
});
As far as I can understand when I click on the proper <div> it should
change the value of parent scope variable "myClass" to "class2" value. But
on the UI this change is not reflecting. Should I create maybe isolated
scope or something like that.
Is it possible to change values of the parent scope from the directive ?
Please disregard all miss typos...
Thanks,
Enes
On Wednesday, April 30, 2014 2:29:54 PM UTC+2, Enes Lisovac wrote:
>
> Can someone please explain me how can I reach some specific element which
> is part of the directive. Imagine we have directive that is form with
> multiple inputs in it. How can I reach specific input field from "link"
> function?
>
> Thanks
>
--
You received this message because you are subscribed to the Google Groups
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.