Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
@Injectable({ providedIn: 'root' })
export class FeatureFlagCanLoad implements CanLoad {
constructor(private userQuery: UserQuery) {
}
canLoad(route: Route): boolean {
return this.userQuery.hasFlags(route.data.flags);
}
}
const routes = [{
path: 'bar',
loadChildren: () => import('./bar/bar.module').then(m => m.BarModule),
data: {
flags: 'b'
},
canLoad: [FeatureFlagCanLoad]
}]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment