Skip to content
This repository has been archived by the owner on Jun 26, 2021. It is now read-only.

Commit

Permalink
Merge pull request #369 from dhodgin/issue368
Browse files Browse the repository at this point in the history
add support for templateUrl that is a function. fixes #368
  • Loading branch information
tushargupta51 authored Aug 25, 2016
2 parents 1b99cac + b1b9982 commit 8e8b340
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions lib/adal-angular.js
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,8 @@
}

var routeChangeHandler = function (e, nextRoute) {
var nextRouteUrl;

if (nextRoute && nextRoute.$$route) {
if (isADLoginRequired(nextRoute.$$route, _adal.config)) {
if (!_oauthData.isAuthenticated) {
Expand All @@ -208,8 +210,14 @@
}
}
else {
if (nextRoute.$$route.templateUrl && !isAnonymousEndpoint(nextRoute.$$route.templateUrl)) {
_adal.config.anonymousEndpoints.push(nextRoute.$$route.templateUrl);
if(typeof nextRoute.$$route.templateUrl === "function") {
nextRouteUrl = nextRoute.$$route.templateUrl(nextRoute.params);
} else {
nextRouteUrl = nextRoute.$$route.templateUrl;
}

if (nextRouteUrl && !isAnonymousEndpoint(nextRouteUrl)) {
_adal.config.anonymousEndpoints.push(nextRouteUrl);
}
}
}
Expand Down

0 comments on commit 8e8b340

Please sign in to comment.