Closed kaanlab closed 8 years ago
Add the ng2-toasty element to above or below the router-outlet in application template:
@Component({
selector: 'app',
directives: [Toasty],
template: `
<router-outlet></router-outlet>
<ng2-toasty></ng2-toasty>
`
})
export class AppComponent {
}
So easy, thank you!
Can you help me understand how to use toasty with routing. I have route to new user "/user/add" and route to all users "/users" in my app. I want that when i clicked "onSave()" (in user-add.component) will displays the toasty message and redirect to a page with all users (users-list.component). I have this code in user-add.component:
onSave(){ this.submitted = true; this.userService.addUser(this.user) .then(() => this.notify.emit('User saved!')) .then(() => this.goBack()) .catch(error => this.errorMessage = error);
But it works only on a same page.