Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import { NgModule, Component, Injectable, Input, Output, EventEmitter } from '@angular/core';
- import { Observable } from 'rxjs';
- @NgModule({
- imports: [
- ],
- declarations: [
- UsersPage,
- UsersComponent,
- UserComponent,
- AvatarComponent
- ],
- providers: [
- UsersPageService
- ]
- })
- export class UsersPageModule { }
- @Component({
- selector: 'page-users',
- template: './users-page.html'
- })
- export class UsersPage {
- constructor(
- private usersPage: UsersPageService
- ) { }
- }
- @Injectable()
- export class UsersPageService {
- }
- @Component({
- selector: 'x-users'
- })
- export class UsersComponent {
- private _deleted = new EventEmitter<User>();
- @Input() users: User[];
- @Output() readonly deleted = this._deleted.asObservable();
- constructor() { }
- delete(user: User) {
- this._deleted.next(user);
- }
- }
- @Component({
- selector: 'x-user'
- })
- export class UserComponent {
- private _deleted = new EventEmitter<User>();
- @Input() user: User;
- @Output() readonly deleted = this._deleted.asObservable();
- constructor() { }
- delete() {
- this._deleted.next(this.user);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement