View elements.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { BrowserModule } from '@angular/platform-browser'; | |
import { createCustomElement } from '@angular/elements'; | |
import { NgModule, Injector, NgModuleFactory, NgModuleRef } from '@angular/core'; | |
import { SomeService } from './service' | |
import { AppComponent } from './app.component'; | |
import { DemoElementModule, DemoElement } from './demo-element' | |
import { DemoElementModuleNgFactory } from './demo-element.ngfactory' |
View test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import * as ng from '@angular/platform' | |
function todoAppState(state = {todos: [1,2,3]}, action = {type:''}){ | |
switch (action.type) { | |
case 'ADD_TODO': | |
return { | |
todos: state.todos.concat((action as any).payload), | |
...state | |
} | |
default: |
View deprecate.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//copied from https://github.com/jayphelps/core-decorators | |
const { defineProperty, getOwnPropertyDescriptor, | |
getOwnPropertyNames, getOwnPropertySymbols } = Object; | |
export function isDescriptor(desc) { | |
if (!desc || !desc.hasOwnProperty) { | |
return false; | |
} |
View test.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function (global, factory) { | |
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : | |
typeof define === 'function' && define.amd ? define(['exports'], factory) : | |
(factory((global.lit = {}))); | |
}(this, (function (exports) { 'use strict'; | |
/** | |
* @license | |
* Copyright (c) 2017 The Polymer Project Authors. All rights reserved. | |
* This code may only be used under the BSD style license found at |
View enums.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
interface Action { | |
type: string; | |
} | |
enum UserActions { | |
ADD_USER = 'ADD_USER', | |
DELETE_USER = 'DELETE_USER' | |
} |
View testing.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
describe(‘My Effects’, () => { | |
let effects: MyEffects; | |
let actions: Observable<any>; | |
beforeEach(() => { | |
TestBed.configureTestingModule({ | |
providers: [ | |
MyEffects, | |
provideMockActions(() => actions), | |
// other providers |
View app.module.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@NgModule({ | |
imports: [ | |
StoreModule.forRoot(appReducers), | |
EffectsModule.forRoot([SourceA, SourceB]), | |
RouterModule.forRoot([ | |
{ path: ‘lazy’, loadModule: ‘./lazy.module#LazyModule’ } | |
]) | |
] | |
}) | |
export class AppModule { } |
View add-drama.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import {InjectionToken} from '@angular/core' | |
import {Http} from '@angular/http' | |
import {Observable} from 'rxjs/Rx' | |
//simple fn | |
export function AddDrama(value:string){ | |
return `${value}!!!` | |
} | |
export const AddDramaProvider = { |
View custom-element.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//hacked up view engine parts | |
import {ComponentFactory, ComponentRef} from './core/linker/component_factory'; | |
import {ErrorHandler} from './core/error_handler'; | |
import {Injector} from './core/di/injector'; | |
import {NgModuleRef} from './core/linker/ng_module_factory'; | |
import {RendererFactory2} from './core/render/api'; | |
import {Sanitizer} from './core/security'; | |
import {initServicesIfNeeded} from './core/view/index'; | |
import {SimpleRendererFactory} from './core/renderer'; |
View input.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import {NgModule, Component} from '@angular/core' | |
import {BrowserModule} from '@angular/platform-browser' | |
@Component({ | |
selector: 'demo-app', | |
template: ` | |
<h1>hello {{name}}</h1> | |
` | |
}) | |
export class DemoApp { |