I have two controller that they aren't any relation and want to know smtg in controller1 when happen a change in controller2. like this: Update smtg in controller2 after changing controller1 to understand that.
export class Test1Controller{
public scope: IScoring;
$onInit() {
}
constructor($scope: IScoring, public $crypto, public toastr: angular.toastr.IToastrService) {
this.scope = $scope;
this.scope.Ctrl = this;
}
private Understand ()
{
// know aboat Test2Controller happens ...
}
}
export class Test2Controller{
public scope: IScoring;
$onInit() {
}
constructor($scope: IScoring, public $crypto, public toastr: angular.toastr.IToastrService) {
this.scope = $scope;
}
private Update()
{
this.$http.post('https://api.test.com', this.scope.docs).then((response: any) => {
this.toastr.success("done!");
this.scope.docs.Document = "";
},
function (error) { console.log(error); this.toastr.error("error"); });
}
}