<!DOCTYPE html>
<html>
<head>
<title>Angular 2 Material Plunker</title>
<!-- Load common libraries -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/typescript/2.1.1/typescript.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/core-js/2.4.1/core.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/zone.js/0.7.2/zone.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/systemjs/0.19.41/system.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/hammer.js/2.0.8/hammer.min.js"></script>
<!-- Configure SystemJS -->
<script src="systemjs.config.js"></script>
<script>
System
.import('main.ts')
.catch(console.error.bind(console));
</script>
<!-- Load the Angular Material 2 stylesheet -->
<link href="https://rawgit.com/angular/material2-builds/master/core/theming/prebuilt/indigo-pink.css" rel="stylesheet">
<style>html, body, material-app { font-family: Roboto,"Helvetica Neue",sans-serif; height: 100%; margin:0;padding:0}</style>
</head>
<body>
<material-app>Loading the Angular 2 Material App...</material-app>
</body>
</html>
<!--
Copyright 2016 Google Inc. All Rights Reserved.
Use of this source code is governed by an MIT-style license that
can be found in the LICENSE file at http://angular.io/license
-->
import {Component} from '@angular/core';
import {Http} from '@angular/http'
import {bootstrap} from '@angular/platform-browser-dynamic';
@Component({
selector: 'material-app',
templateUrl: 'app.component.html',
styleUrls: ['./app.component.css']
})
export class AppComponent {
private version: any;
constructor(http: Http) {
// Display the currently used Material 2 version.
this.version = http
.get('https://api.github.com/repos/angular/material2-builds/commits/HEAD')
.map(res => res.json())
}
}
/*
Copyright 2016 Google Inc. All Rights Reserved.
Use of this source code is governed by an MIT-style license that
can be found in the LICENSE file at http://angular.io/license
*/
<app-logs></app-logs>
/** Add Transpiler for Typescript */
System.config({
transpiler: 'typescript',
typescriptOptions: {
emitDecoratorMetadata: true
},
packages: {
'.': {
defaultExtension: 'ts'
},
'vendor': {
defaultExtension: 'js'
}
}
});
System.config({
map: {
'main': 'main.js',
// Angular specific mappings.
'@angular/core': 'http://unpkg.com/@angular/core/bundles/core.umd.js',
'@angular/common': 'http://unpkg.com/@angular/common/bundles/common.umd.js',
'@angular/compiler': 'http://unpkg.com/@angular/compiler/bundles/compiler.umd.js',
'@angular/http': 'http://unpkg.com/@angular/http/bundles/http.umd.js',
'@angular/forms': 'http://unpkg.com/@angular/forms/bundles/forms.umd.js',
'@angular/router': 'http://unpkg.com/@angular/router/bundles/router.umd.js',
'@angular/platform-browser': 'http://unpkg.com/@angular/platform-browser/bundles/platform-browser.umd.js',
'@angular/platform-browser-dynamic': 'http://unpkg.com/@angular/platform-browser-dynamic/bundles/platform-browser-dynamic.umd.js',
'@angular/material': 'https://rawgit.com/angular/material2-builds/master/bundles/material.umd.js',
// Rxjs mapping
'rxjs': 'https://unpkg.com/rxjs',
},
packages: {
// Thirdparty barrels.
'rxjs': { main: 'index' },
}
});
/*
Copyright 2016 Google Inc. All Rights Reserved.
Use of this source code is governed by an MIT-style license that
can be found in the LICENSE file at http://angular.io/license
*/
import {platformBrowserDynamic} from '@angular/platform-browser-dynamic';
import {BrowserModule} from '@angular/platform-browser';
import {NgModule} from '@angular/core';
import {CommonModule} from '@angular/common';
import {FormsModule} from '@angular/forms';
import {AppComponent} from './app.component';
import {LogsComponent} from './logs.component';
import {SearchSidebarComponent} from './search-sidebar.component';
import {MaterialModule} from '@angular/material';
@NgModule({
imports: [
BrowserModule,
FormsModule,
CommonModule,
MaterialModule.forRoot(),
],
declarations: [AppComponent,LogsComponent,SearchSidebarComponent],
bootstrap: [AppComponent],
providers: []
})
export class PlunkerAppModule {}
platformBrowserDynamic().bootstrapModule(PlunkerAppModule);
/*
Copyright 2016 Google Inc. All Rights Reserved.
Use of this source code is governed by an MIT-style license that
can be found in the LICENSE file at http://angular.io/license
*/
import { Component, OnInit } from '@angular/core';
@Component({
selector: 'app-logs',
templateUrl: './logs.component.html',
styleUrls: ['./logs.component.css']
})
export class LogsComponent {
items= [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25];
selected: string = '';
}
.container {
display: flex;
height: 100%;
flex-direction: column;
}
.toolbar {
border:1px solid red;
padding: 10px;
}
.logpanel {
display: flex;
}
app-search-sidebar {
overflow-y: auto;
}
app-search-sidebar > div {
padding: 10px;
}
.container > md-tab-group {
margin-left: 10px;
flex: 1;
}
<div class="container">
<div class="toolbar">
Toolbar goes here
</div>
<div class="logpanel">
<app-search-sidebar (selectedChanged)="selected=$event" [items]="items"></app-search-sidebar>
<md-tab-group *ngIf="selected">
<md-tab [label]="selected">
<h1>{{selected}}</h1>
<p>...</p>
</md-tab>
</md-tab-group>
</div>
</div>
import { Component, Input, Output, EventEmitter } from '@angular/core';
@Component({
selector: 'app-search-sidebar',
templateUrl: './search-sidebar.component.html',
styleUrls: ['./search-sidebar.component.css']
})
export class SearchSidebarComponent {
@Input() public items: string[] = [];
@Output() selectedChanged: EventEmitter<string> = new EventEmitter<string>();
private _selected: string = '';
private searchValue: string;
changeSearch(search: string) {
this.searchValue = search;
}
isSelected(item: string) {
return this.selected === item;
}
changeSelected(selected: string) {
if (this.selected !== selected) {
this.selected = selected;
}
}
get selected() {
return this._selected;
}
set selected(selected: string) {
this._selected = selected;
this.selectedChanged.emit(this.selected);
}
}
<div>
<label class="sr-only" for="processName">Process Name</label>
<div class="input-group mb-2 mr-sm-2 mb-sm-0">
<div class="input-group-addon">
<md-icon>search</md-icon>
</div>
<input type="text" [(ngModel)]="searchValue" class="form-control" id="processName" placeholder="Process Name">
</div>
<div class="process-list">
<md-list>
<md-list-item *ngFor="let item of items">
<button md-raised-button [color]="isSelected(item) ? 'primary' : ''"
class="process-name" (click)="changeSelected(item)">
{{item}}
</button>
</md-list-item>
</md-list>
</div>
</div>
.process-name {
width: 100%;
}
.process-list {
}
app-logs { height: 100%; }