Skip to content

Instantly share code, notes, and snippets.

@afirdousi
Created July 8, 2017 02:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save afirdousi/deb6f11226dc6a0d99826407972d46b3 to your computer and use it in GitHub Desktop.
Save afirdousi/deb6f11226dc6a0d99826407972d46b3 to your computer and use it in GitHub Desktop.
@Component({
selector: 'my-app',
template: `
<div [ngClass]="theme">
<h2>{{name}}</h2>
<div>Themes implemented</div> <br/><br/>
Select Theme : <a href="#" (click)="setTheme('light')">Light </a> |
<a href="#" (click)="setTheme('dark')">Dark</a> |
<a href="#" (click)="setTheme('')">No theme</a><br/><br/>
<p> <b>Current Theme : </b> {{ theme || 'none' }} </p>
<custom-input [placeholder]="'Your name ...'" ></custom-input> <br/>
<custom-button [text]="'Sign In'" [state]="'primary'" ></custom-button>
</div>
`,
})
export class App {
name:string;
theme = ''; // No initial theme set
constructor() {
this.name = `Themeable Components - Part 2 - Angular! v${VERSION.full}`
}
setTheme(theme){
this.theme = theme;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment