I'm pretty new to AngularJS so this problem might be really easy to solve.
I'm doing a modal, and so far it opens correctly with the template and css working, the only thing that doesn't work is the function inside the template. I have a ng-click, and when I click the function doesn't get called.
modal controller:
export class modalCtrl {
static $inject = ["$uibModalInstance", "dataList"];
constructor(private $uibModalInstance: ng.ui.bootstrap.IModalServiceInstance, public dataList: Array<Interfaces.dataList>) { }
close(): void {
this.$uibModalInstance.close();
}
}
module.controller("modalCtrl", ModalCtrl);
function to launch the modal in my main controller:
openModal(event: ng.IAngularEvent) {
event.stopPropagation();
this.$uibModal.open({
controller: "modalCtrl",
controllerAs: "vm",
resolve: {
dataList: () => this.dataList
},
templateUrl: "modalTemplate.htm"
});
}
the function I'm calling from insde the modal on the ng-click:
selectDataEntry(item: Interfaces.dataList) {
this.dataList.forEach(p => p.isSelected = false);
item.isSelected = true;
console.log('ngclick works');
}
so I put inside the resolve of the modal the interface I'm using to retrieve the data, and this solved the other problem I had, the ng-repeat that looped over this interface wasn't working, now it is. But the function doesnt get called, so I guess I need to do something else as well with the scopes, can someone help me? thank you