Last active
March 12, 2017 13:27
-
-
Save brakmic/a20aa639802e5d5625314576b10da318 to your computer and use it in GitHub Desktop.
reacting to route changes in vrwrappercomponent
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Each time the route changes take the ID and instantiate the appropriate vr element. | |
// If the element contains a script-array load them too. | |
// Check shared/directives/vr-element.directive.ts for more info regarding | |
// dynamic instantiation of vr elements. | |
this.routeSubscription = this.route.params.subscribe((params) => { | |
const id = params['id']; | |
const mod = _.find(this.availableModules, (m) => m.id === id); | |
if (!_.isNil(mod)) { | |
this.dynamicComponent = { | |
html: mod ? mod.markup : undefined, | |
scripts: mod ? mod.scripts : [] | |
}; | |
this.changeDetectorRef.markForCheck(); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment