I don't want to post too much Code here, I am currently just struggling with something basic.
I have a directive restricted as attribute:
export class MyDirective implements ng.IDirective {
bindToController = true;
controller = MyDirectiveController;
controllerAs = "vm";
restrict = "A";
scope = true;
constructor(){
};
}
The Controller looks like this:
export interface IMyDirectiveScope{
isTrue:boolean;
}
export class MyDirectiveController implements IMyDirectiveScope{
public isTrue:boolean;
constructor() {
this.isTrue = false;
}
}
Now what I basically want, is to access the isTrue
variable. Nothing more.
So here is my HTML, where I want to do this:
<div my-directive>
<ul>
<button type="button" ng-click="vm.isTrue = !vm.isTrue"></button>
</ul>
<some-other-directive ng-show="vm.isTrue"></some-other-directive>
</div>
Just for some background-info, I want to toggle the some-other-directive
which is kind of a sidemenu. Inside this I will do a require, where I will fetch the MyDirectiveController to also access the isTrue
variable.