I'm currently working on implementing a "confirm" button for users of my website to see after clicking a specific button, using an angularJS class. Below is the code snippet I have written:
class TodosListCtrl {
constructor($scope, $window){
$scope.viewModel(this);
this.$scope = $scope;
}
//... several functions
Clear(){
var delete = this.$scope.confirm("Are you sure you want to clear the text?");
if(delete){
//delete operation
}
}
However, every time I click on the button triggering the "Clear()" function, I encounter the error
"this.$scope.confirm is not a function at TodosListCtrl.Clear"
Could someone please explain why this issue is occurring and provide guidance on how to resolve it?