Thursday, 16 February 2017

NG2- router/URL change function call

NG2- router change function call
============================
import { Router } from '@angular/router'

@Component{

Export Class Mycomponent{

Constructor(_router: Router){

 _router.events.subscribe((val) => {
                this.searchChange = '';
}

}

Ref:http://stackoverflow.com/questions/33520043/how-to-detect-a-route-change-in-angular-2

No comments:

Post a Comment

KISS, DRY, SOLID, YAGNI — A Simple Guide to Some Principles of Software Engineering and Clean Code

1 — KISS (Keep It Simple, Stupid)  Simplicity triumphs over complexity. Direct and clear codes are better for developing, maintaining, and s...