Skip to content

Instantly share code, notes, and snippets.

@ravipatel2293
Created May 22, 2018 15:42
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ravipatel2293/0a8b01559ef5b3b755b7c11095769c4e to your computer and use it in GitHub Desktop.
Save ravipatel2293/0a8b01559ef5b3b755b7c11095769c4e to your computer and use it in GitHub Desktop.
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);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment