This file contains hidden or 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
ngapp() { | |
ng new $1 --style=sass --skip-npm && cd $1 && yarn | |
} |
This file contains hidden or 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
ngapp() { | |
ng new $1 --style=sass --skip-npm && cd $1 && yarn \ | |
&& open http://localhost:4200 \ | |
&& code . | |
} |
This file contains hidden or 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
ngapp() { | |
ng new $1 --style=sass --skip-npm && cd $1 && yarn \ | |
&& open http://localhost:4200 \ | |
&& code . \ | |
&& yarn start | |
} |
This file contains hidden or 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 { Directive, Input, OnInit, TemplateRef, ViewContainerRef } from '@angular/core'; | |
import { UserService } from './user.service'; | |
import { UserRole } from '../shared/models/user-role'; | |
@Directive({ | |
selector: '[tsIfRole]' | |
}) | |
export class IfRoleDirective implements OnInit { | |
role: UserRole; |
This file contains hidden or 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 { Input, Component, ViewEncapsulation, EventEmitter, Output } from '@angular/core'; | |
@Component({ | |
selector: 'custom-button', | |
template: `<button (click)="handleClick()">{{label}}</button>`, | |
styles: [` | |
button { | |
border: solid 3px; | |
padding: 8px 10px; | |
background: #bada55; |
This file contains hidden or 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 'zone.js/dist/zone'; | |
import '@webcomponents/custom-elements/src/native-shim'; | |
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; | |
import { ButtonModule } from './button.module'; | |
platformBrowserDynamic().bootstrapModule(ButtonModule); |
This file contains hidden or 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 { Directive, ElementRef, Input, OnChanges } from '@angular/core'; | |
/** | |
* Usage: | |
* <mycomponent [dtTheme]="{'color-main': '#bada55'}"></mycomponent> | |
*/ | |
@Directive({ | |
selector: '[dtTheme]' | |
}) | |
export class ThemeDirective implements OnChanges { |
This file contains hidden or 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
window.devtoolsFormatters = [{ | |
header: function(obj){ | |
if (!obj.__clown) { | |
return null; | |
} | |
delete obj.__clown; | |
const style = ` | |
color: red; | |
border: dotted 2px gray; | |
border-radius: 4px; |