Skip to content

Instantly share code, notes, and snippets.

ravipatel2293

View GitHub Profile
View ClickOutSide.vue
// This variable will hold the reference to the document's click handler
let handleOutsideClick
// Difining clickoutside globally for the application
// so it will be used across all the components
Vue.directive('clickoutside', {
// bind the logic to the html element
bind (el, binding, vnode) {
// Here's the click/touchstart handler
// (it is registered below)
View App.vue
<template>
<div id="app">
<div>
<button
ref="btn1"
class="toggle-button"
>
Open Country Popup
</button>
<div
View read-movie.component.ts
import { MovieStore } from './../movie.store';
import { Component, OnInit } from '@angular/core';
@Component({
selector: 'app-read-movie',
templateUrl: './read-movie.component.html',
styleUrls: ['./read-movie.component.css']
})
export class ReadMovieComponent implements OnInit {
public movieList: any;
View create-movie.component.ts
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']
})
View movie.actions.ts
export const ADD_MOVIE = '[MOVIE] Add';
export const REMOVE_MOVIE = '[MOVIE] Remove';
View movie.reducer.ts
import { Injectable } from '@angular/core';
import { ADD_MOVIE } from './movie.actions';
import { MovieStore } from './movie.store';
@Injectable()
export class MovieReducers {
constructor(private _movieStore: MovieStore) {
}
View movie.store.ts
import { ADD_MOVIE } from './movie.actions';
import { Http, Headers, Response } from '@angular/http';
import { Injectable } from '@angular/core';
import { Observable } from 'rxjs/Observable';
import { Subject } from 'rxjs/Subject';
import { BehaviorSubject } from 'rxjs/BehaviorSubject';
@Injectable()
export class MovieStore {
View gist:ab0bd9247705d6a6a712b2fa3ef14142
/**
* This file includes polyfills needed by Angular and is loaded before the app.
* You can add your own extra polyfills to this file.
*
* This file is divided into 2 sections:
* 1. Browser polyfills. These are applied before loading ZoneJS and are sorted by browsers.
* 2. Application imports. Files imported after ZoneJS that should be loaded before your main
* file.
*
* The current setup is for so-called "evergreen" browsers; the last versions of browsers that
View gist:c81010186951041b668e2ad6615511d1
// Karma configuration file, see link for more information
// https://karma-runner.github.io/0.13/config/configuration-file.html
module.exports = function (config) {
config.set({
basePath: '',
frameworks: ['jasmine', '@angular/cli'],
plugins: [
require('karma-jasmine'),
// require('karma-chrome-launcher'), /*comment out this line to disable the karma-chrome-launcher*/
View Install Angular cli
npm install -g @angular/cli
ng --version # Check version: @angular/cli: 1.3.0, node: 8.1.2
ng new angular-ci
cd angular-ci
ng serve
You can’t perform that action at this time.