10 examples of 'routerlink angular2' in JavaScript

Every line of 'routerlink angular2' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your JavaScript code is secure.

All examples are scanned by Snyk Code

By copying the Snyk Code Snippets you agree to
this disclaimer
42function RouterLink(elementRef, _router, _location) {
43 this._router = _router;
44 this._location = _location;
45 this._domEl = elementRef.domElement;
46 this._params = collection_1.StringMapWrapper.create();
47}
Important

Use secure code every time

Secure your code as it's written. Use Snyk Code to scan source code in minutes – no build needed – and fix issues immediately. Enable Snyk Code

75function RouterLinkWithHref(router, route, locationStrategy) {
76 var _this = this;
77 this.router = router;
78 this.route = route;
79 this.locationStrategy = locationStrategy;
80 this.commands = [];
81 this.subscription = router.events.subscribe(function (s) {
82 if (s instanceof router_1.NavigationEnd) {
83 _this.updateTargetUrlAndHref();
84 }
85 });
86}
35routerLink(content) {
36 const component = content.path.split('/')[1];
37 const path = `/#/components/${component}/${component}-demo`;
38 window.location.href = window.location.origin + this.suffix(path);
39}
33export function link(route, params) {
34 return () => navigate(route, params);
35}
19set routerLink(data) {
20 if (Array.isArray(data)) {
21 this.commands = data;
22 }
23 else {
24 this.commands = [data];
25 }
26}
117ngOnChanges(changes: SimpleChanges): void { this.update(); }
207visitDirective(ast: DirectiveAst, context: any): any {
208 let updatedInputs = ast.inputs.map(c => c.visit(this, context));
209 return new DirectiveAst(ast.directive, updatedInputs, ast.hostProperties, ast.hostEvents,
210 ast.sourceSpan);
211}
23export function href<RN extends Routes>(router: Router, route: RN, params: RouteParams[RN]) {
24 return router.link(`app.${route}`, params)
25}
105ngAfterContentInit(): void {
106 this.links.changes.subscribe(_ => this.update());
107 this.linksWithHrefs.changes.subscribe(_ => this.update());
108 this.update();
109}
10constructor(
11 private _activatedroute:ActivatedRoute
12) { }

Related snippets