Hey,
Let me consider that you have some service made available on clicking on button (assume multiply).
So you can have that routing making available through $routeProvider and can have condition on resolve result( Let me having condition that if my result is greater than 200 i will show error else show the result. To accomplished this follow the below code.
var app=angular.module('app',[;ngroute'])
app.config( [ '$routeProvider', function($routeProvider){
$routeProvider.when('/calc/){
template: <Strong> First Page</strong>
$routeProvider.when('/calc/mult/:a/:b){
template: "mult.html",
controller: MultController,
resolve:{
multResult: function( $dataservice, $route,$q){
var a=$route.current.params.a;
var b=$route.current.params.b;
result.dataservice.multiply(a,b).then function(result){
if(result.data>200){
return $q.reject("Cannot have result");
}
else{
return result;
}
});
}
}
});
Hope, This is working for you now!!