Skip to content

Commit 3a74da6

Browse files
authored
Sander/fix193 route service (#198)
* fix(js plugins): updat eto use new register function * fix(scullyrouteservice): fir issue #193 This fixes the issue where getCurrent() can give the the wrong result. A beeter check is in place now closes #193
1 parent a2416df commit 3a74da6

3 files changed

Lines changed: 13 additions & 8 deletions

File tree

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,20 @@
1-
import { Component, OnInit } from '@angular/core';
1+
import {Component, OnInit} from '@angular/core';
2+
import {ScullyRoutesService} from '@scullyio/ng-lib';
3+
import {take} from 'rxjs/operators';
24

35
@Component({
46
selector: 'app-about',
57
templateUrl: './about.component.html',
6-
styleUrls: ['./about.component.css']
8+
styleUrls: ['./about.component.css'],
79
})
810
export class AboutComponent implements OnInit {
11+
constructor(private srs: ScullyRoutesService) {}
912

10-
constructor() { }
11-
12-
ngOnInit() {
13+
async ngOnInit() {
14+
const cur = await this.srs
15+
.getCurrent()
16+
.pipe(take(1))
17+
.toPromise();
18+
console.log(cur);
1319
}
14-
1520
}

projects/scullyio/ng-lib/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@scullyio/ng-lib",
3-
"version": "0.0.10",
3+
"version": "0.0.11",
44
"repository": {
55
"type": "GIT",
66
"url": "https://github.com/scullyio/scully/tree/master/projects/scullyio/ng-lib"

projects/scullyio/ng-lib/src/lib/route-service/scully-routes.service.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ export class ScullyRoutesService {
4444
map(list =>
4545
list.find(
4646
r =>
47-
curLocation.includes(r.route) ||
47+
curLocation.trim() === r.route.trim() ||
4848
(r.slugs &&
4949
Array.isArray(r.slugs) &&
5050
r.slugs.find(slug => curLocation.includes(slug)) !== undefined)

0 commit comments

Comments
 (0)