Within my app.js file, I am setting up routes to direct to various controllers using the following code snippet:
var urlArray=['Suggest','Comment'];
var pdfURL="Suggest";
app.config(function($routeProvider,$locationProvider) {
.when('/datatrial/' +pdfURL, {
templateUrl: 'simple/TestPanelTrial.html',
controller: 'SimpleDemoTrailController'
});});
Currently, I am introducing the variable pdfUrl. I wish to include a condition where if pdfURL matches any string within the urlArray, then the 'when' statement should be utilized to redirect to the appropriate controller. The code above resides in app.js, which is the initial file to load. How can I implement this scenario?