How do i access This of controller inside of directive and its template when not using isoloted scope?
app.controller('ChildCtrl', function() {
this.name = "Name from children";
});
How do i access This of controller inside of directive and its template when not using isoloted scope?
app.controller('ChildCtrl', function() {
this.name = "Name from children";
});
Copyright © 2021 Jogjafile Inc.
Simple parse it as
controller as instance valueinto your directive scope like in this simple fiddle demo:View
AngularJS application
An other approach is to just parse your controller into the directive by using
controller:'MyCtrl as ctrl'like in this demo fiddle.View
AngularJS application
You can also parse the hole controller instance to in scope and access it like in this demo fiddle.
View
AngularJS application