Guest User

Untitled

a guest
May 27th, 2018
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.96 KB | None | 0 0
  1. import { ADD_MOVIE } from './../movie.actions';
  2. import { MovieReducers } from './../movie.reducer';
  3. import { MovieStore } from './../movie.store';
  4. import { Component, OnInit, ViewChild, ElementRef } from '@angular/core';
  5.  
  6. @Component({
  7. selector: 'app-create-movie',
  8. templateUrl: './create-movie.component.html',
  9. styleUrls: ['./create-movie.component.css']
  10. })
  11. export class CreateMovieComponent implements OnInit {
  12.  
  13. @ViewChild('movieName') movieName: ElementRef;
  14. @ViewChild('movieUrl') movieUrl: ElementRef;
  15.  
  16. constructor(private _movieStore: MovieStore, private _movieReducers: MovieReducers) { }
  17.  
  18. ngOnInit() {
  19. }
  20.  
  21. addMovie(): void {
  22. this._movieReducers.movieReducer({
  23. type: ADD_MOVIE, payload: {
  24. name: this.movieName.nativeElement.value,
  25. url: this.movieUrl.nativeElement.value,
  26. }
  27. });
  28. this.movieName.nativeElement.value = '';
  29. this.movieUrl.nativeElement.value = ''
  30. console.log(this.movieName.nativeElement.value);
  31.  
  32. }
  33.  
  34. }
Add Comment
Please, Sign In to add comment