Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import { ADD_MOVIE } from './../movie.actions';
- import { MovieReducers } from './../movie.reducer';
- import { MovieStore } from './../movie.store';
- import { Component, OnInit, ViewChild, ElementRef } from '@angular/core';
- @Component({
- selector: 'app-create-movie',
- templateUrl: './create-movie.component.html',
- styleUrls: ['./create-movie.component.css']
- })
- export class CreateMovieComponent implements OnInit {
- @ViewChild('movieName') movieName: ElementRef;
- @ViewChild('movieUrl') movieUrl: ElementRef;
- constructor(private _movieStore: MovieStore, private _movieReducers: MovieReducers) { }
- ngOnInit() {
- }
- addMovie(): void {
- this._movieReducers.movieReducer({
- type: ADD_MOVIE, payload: {
- name: this.movieName.nativeElement.value,
- url: this.movieUrl.nativeElement.value,
- }
- });
- this.movieName.nativeElement.value = '';
- this.movieUrl.nativeElement.value = ''
- console.log(this.movieName.nativeElement.value);
- }
- }
Add Comment
Please, Sign In to add comment