Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Experimental alpha10 #27

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@
"@angular/http": "^2.0.0",
"@angular/platform-browser": "^2.0.0",
"@angular/platform-browser-dynamic": "^2.0.0",
"@angular/material": "2.0.0-alpha.9-3",
"@angular/material": "2.0.0-alpha.10",
"@angular/router": "^3.0.0",
"core-js": "^2.4.0",
"rxjs": "5.0.0-beta.12",
"ts-helpers": "^1.1.1",
"zone.js": "^0.6.21"
},
"devDependencies": {
"@angular/compiler-cli": "^0.6.3",
"@angular/compiler-cli": "^2.0.0",
"@angular/platform-server": "^2.0.0",
"@types/hammerjs": "^2.0.32",
"@types/jasmine": "^2.2.30",
Expand Down
25 changes: 10 additions & 15 deletions src/app/app.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -96,26 +96,15 @@ <h3 md-line>{{food.name}}</h3>

<md-card>
<md-tab-group>
<md-tab>
<template md-tab-label>
Earth
</template>
<template md-tab-content>
<p>EARTH</p>
</template>
<md-tab label="Earth">
<p>EARTH</p>
</md-tab>
<md-tab>
<template md-tab-label>
Fire
</template>
<template md-tab-content>
<p>FIRE</p>
</template>
<md-tab label="Fire">
<p>FIRE</p>
</md-tab>
</md-tab-group>
</md-card>


<md-card>
<md-icon>build</md-icon>
</md-card>
Expand All @@ -132,6 +121,12 @@ <h3 md-line>{{food.name}}</h3>
<button md-menu-item>Banana</button>
</md-menu>

<md-card>
<p>Last dialog result: {{lastDialogResult}}</p>
<button md-raised-button (click)="openDialog()">DIALOG</button>
<button md-raised-button (click)="showSnackbar()">SNACKBAR</button>
</md-card>

</div>

</md-sidenav-layout>
Expand Down
35 changes: 33 additions & 2 deletions src/app/app.component.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import {Component} from '@angular/core';
import {Component, Optional} from '@angular/core';
import {MdDialog, MdDialogRef, MdSnackBar} from '@angular/material';


@Component({
Expand All @@ -8,6 +9,7 @@ import {Component} from '@angular/core';
})
export class Material2AppAppComponent {
isDarkTheme: boolean = false;
lastDialogResult: string;

foods: any[] = [
{name: 'Pizza', rating: 'Excellent'},
Expand All @@ -17,10 +19,39 @@ export class Material2AppAppComponent {

progress: number = 0;

constructor() {
constructor(private _dialog: MdDialog, private _snackbar: MdSnackBar) {
// Update the value for the progress-bar on an interval.
setInterval(() => {
this.progress = (this.progress + Math.floor(Math.random() * 4) + 1) % 100;
}, 200);
}

openDialog() {
let dialogRef = this._dialog.open(DialogContent);

dialogRef.afterClosed().subscribe(result => {
this.lastDialogResult = result;
})
}

showSnackbar() {
this._snackbar.open('YUM SNACKS', 'CHEW');
}
}


@Component({
template: `
<p>This is a dialog</p>
<p>
<label>
This is a text box inside of a dialog.
<input #dialogInput>
</label>
</p>
<p> <button md-button (click)="dialogRef.close(dialogInput.value)">CLOSE</button> </p>
`,
})
export class DialogContent {
constructor(@Optional() public dialogRef: MdDialogRef<DialogContent>) { }
}
5 changes: 3 additions & 2 deletions src/app/app.module.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
import {NgModule} from '@angular/core';
import {BrowserModule} from '@angular/platform-browser';
import {MaterialModule} from '@angular/material';
import {Material2AppAppComponent} from './app.component';
import {Material2AppAppComponent, DialogContent} from './app.component';

@NgModule({
imports: [
BrowserModule,
MaterialModule.forRoot(),
],
declarations: [Material2AppAppComponent],
declarations: [Material2AppAppComponent, DialogContent],
entryComponents: [DialogContent],
bootstrap: [Material2AppAppComponent],
})
export class MaterialAppModule { }