Creating a simple Cancel Custom Widget
Hi there,
I'm trying to create a simple Cancel Custom Widget for use in Instantiation forms, for when a user realizes they don't want to do the process...
My template is:
<button type="button">Cancel</button>
</div>
and my controller is:
console.log("Doing it anyway!"); //#1
$scope.onClick = function cancelOnClick($scope, $window) {
console.log("cancelling!"); //#2
$window.top.location.href = '/' + $scope.properties.bonitaWebAppName;
};
}
with one property:
Label: Bonita web app name
Treat as Dynamic value
Type: text
Default value: bonita
When I execute the process I always get the "Doing it anyway!" //#1 message but when I click the Button it never seems to fire...
I'm trying to learn angularjs but, it's not that easy... :)
Thanks for the advice in advance,
regards
Sean
Update:
I've now seen how to do it...
<button type="button" ng-click="ctrl.cancelOnClick()">Cancel</button>
</div>
with controller:
console.log("Doing it anyway!");
this.onClick = function cancelOnClick() {
console.log("cancelling!");
$window.top.location.href = '/' + $scope.properties.bonitaWebAppName;
};
}
But it still doesn't work...
OK, in the end I worked it out.
Don't use a DIV around the button...
So my final code for the Cancel button template is
and the Controller
this.cancelOnClick = function () {
$window.top.location.href = '/' + $scope.properties.bonitaWebAppName;
};
}
I've used the parameter as well
Label: Bonita web app name
Treat as Dynamic value
Type: text
Default value: bonita
Bonita web app name: the name of Bonita Portal web application. By default "bonita". This will be used to build REST API URL but also to redirect user to Portal welcome page if no tasks are available
Hope it helps others
regards
Sean