Added details and routing

This commit is contained in:
2017-04-05 12:48:40 +02:00
parent d773389a4b
commit cff7dd5338
15 changed files with 1589 additions and 1479 deletions
+1 -1
View File
File diff suppressed because one or more lines are too long
+116 -51
View File
@@ -1,13 +1,13 @@
webpackJsonp([1,4],{
/***/ 215:
/***/ 151:
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_rxjs_add_operator_map__ = __webpack_require__(674);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_rxjs_add_operator_map__ = __webpack_require__(676);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_rxjs_add_operator_map___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_rxjs_add_operator_map__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__angular_http__ = __webpack_require__(307);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__angular_http__ = __webpack_require__(308);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return DataService; });
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
@@ -86,7 +86,7 @@ function toDevice(r) {
/***/ }),
/***/ 330:
/***/ 331:
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
@@ -108,7 +108,7 @@ var DashboardComponent = (function () {
DashboardComponent = __decorate([
__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Component"])({
selector: 'dashboard',
template: __webpack_require__(669)
template: __webpack_require__(670)
}),
__metadata('design:paramtypes', [])
], DashboardComponent);
@@ -118,12 +118,59 @@ var DashboardComponent = (function () {
/***/ }),
/***/ 331:
/***/ 332:
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__data_service__ = __webpack_require__(215);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__angular_router__ = __webpack_require__(213);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__data_service__ = __webpack_require__(151);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return DetailComponent; });
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
var DetailComponent = (function () {
function DetailComponent(dataService, route) {
this.dataService = dataService;
this.route = route;
}
DetailComponent.prototype.ngOnInit = function () {
var id = this.route.params['id'];
this.dataService
.get(id)
.subscribe(function (res) {
});
};
DetailComponent = __decorate([
__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Component"])({
selector: 'detail',
template: __webpack_require__(671)
}),
__metadata('design:paramtypes', [(typeof (_a = typeof __WEBPACK_IMPORTED_MODULE_2__data_service__["a" /* DataService */] !== 'undefined' && __WEBPACK_IMPORTED_MODULE_2__data_service__["a" /* DataService */]) === 'function' && _a) || Object, (typeof (_b = typeof __WEBPACK_IMPORTED_MODULE_1__angular_router__["b" /* ActivatedRoute */] !== 'undefined' && __WEBPACK_IMPORTED_MODULE_1__angular_router__["b" /* ActivatedRoute */]) === 'function' && _b) || Object])
], DetailComponent);
return DetailComponent;
var _a, _b;
}());
//# sourceMappingURL=C:/Users/avans/Documents/Angular/Smarthome-local/mean-app/src/detail.component.js.map
/***/ }),
/***/ 333:
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__data_service__ = __webpack_require__(151);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__angular_router__ = __webpack_require__(213);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return DeviceComponent; });
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
@@ -136,8 +183,10 @@ var __metadata = (this && this.__metadata) || function (k, v) {
};
var DeviceComponent = (function () {
function DeviceComponent(dataService) {
function DeviceComponent(router, dataService) {
this.router = router;
this.dataService = dataService;
}
DeviceComponent.prototype.ngOnInit = function () {
@@ -148,21 +197,24 @@ var DeviceComponent = (function () {
_this.devices = res;
});
};
DeviceComponent.prototype.goToDetail = function (id) {
this.router.navigate(['/detail', id]);
};
DeviceComponent = __decorate([
__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Component"])({
selector: 'device',
template: __webpack_require__(670)
template: __webpack_require__(672)
}),
__metadata('design:paramtypes', [(typeof (_a = typeof __WEBPACK_IMPORTED_MODULE_1__data_service__["a" /* DataService */] !== 'undefined' && __WEBPACK_IMPORTED_MODULE_1__data_service__["a" /* DataService */]) === 'function' && _a) || Object])
__metadata('design:paramtypes', [(typeof (_a = typeof __WEBPACK_IMPORTED_MODULE_2__angular_router__["c" /* Router */] !== 'undefined' && __WEBPACK_IMPORTED_MODULE_2__angular_router__["c" /* Router */]) === 'function' && _a) || Object, (typeof (_b = typeof __WEBPACK_IMPORTED_MODULE_1__data_service__["a" /* DataService */] !== 'undefined' && __WEBPACK_IMPORTED_MODULE_1__data_service__["a" /* DataService */]) === 'function' && _b) || Object])
], DeviceComponent);
return DeviceComponent;
var _a;
var _a, _b;
}());
//# sourceMappingURL=C:/Users/avans/Documents/Angular/Smarthome-local/mean-app/src/device.component.js.map
/***/ }),
/***/ 387:
/***/ 389:
/***/ (function(module, exports) {
function webpackEmptyContext(req) {
@@ -171,20 +223,20 @@ function webpackEmptyContext(req) {
webpackEmptyContext.keys = function() { return []; };
webpackEmptyContext.resolve = webpackEmptyContext;
module.exports = webpackEmptyContext;
webpackEmptyContext.id = 387;
webpackEmptyContext.id = 389;
/***/ }),
/***/ 388:
/***/ 390:
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_platform_browser_dynamic__ = __webpack_require__(475);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_platform_browser_dynamic__ = __webpack_require__(477);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__angular_core__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__environments_environment__ = __webpack_require__(510);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__app_app_module__ = __webpack_require__(508);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__environments_environment__ = __webpack_require__(511);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__app_app_module__ = __webpack_require__(509);
@@ -197,14 +249,15 @@ __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0__angular_platform_browser_dyna
/***/ }),
/***/ 506:
/***/ 507:
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__angular_router__ = __webpack_require__(495);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__dashboard_component__ = __webpack_require__(330);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__device_component__ = __webpack_require__(331);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__angular_router__ = __webpack_require__(213);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__dashboard_component__ = __webpack_require__(331);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__device_component__ = __webpack_require__(333);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__detail_component__ = __webpack_require__(332);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return AppRoutingModule; });
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
@@ -219,10 +272,12 @@ var __metadata = (this && this.__metadata) || function (k, v) {
var routes = [
{ path: '', redirectTo: '/dashboard', pathMatch: 'full' },
{ path: 'dashboard', component: __WEBPACK_IMPORTED_MODULE_2__dashboard_component__["a" /* DashboardComponent */] },
{ path: 'device', component: __WEBPACK_IMPORTED_MODULE_3__device_component__["a" /* DeviceComponent */] }
{ path: 'device', component: __WEBPACK_IMPORTED_MODULE_3__device_component__["a" /* DeviceComponent */] },
{ path: 'detail/:id', component: __WEBPACK_IMPORTED_MODULE_4__detail_component__["a" /* DetailComponent */] }
];
var AppRoutingModule = (function () {
function AppRoutingModule() {
@@ -240,7 +295,7 @@ var AppRoutingModule = (function () {
/***/ }),
/***/ 507:
/***/ 508:
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
@@ -263,8 +318,8 @@ var AppComponent = (function () {
AppComponent = __decorate([
__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Component"])({
selector: 'app-root',
template: __webpack_require__(667),
styles: [__webpack_require__(666)]
template: __webpack_require__(668),
styles: [__webpack_require__(667)]
}),
__metadata('design:paramtypes', [])
], AppComponent);
@@ -274,22 +329,23 @@ var AppComponent = (function () {
/***/ }),
/***/ 508:
/***/ 509:
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_platform_browser__ = __webpack_require__(148);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__angular_core__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__angular_forms__ = __webpack_require__(466);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__angular_http__ = __webpack_require__(307);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_ng2_charts_ng2_charts__ = __webpack_require__(369);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__angular_forms__ = __webpack_require__(468);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__angular_http__ = __webpack_require__(308);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_ng2_charts_ng2_charts__ = __webpack_require__(371);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_ng2_charts_ng2_charts___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_4_ng2_charts_ng2_charts__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__app_routing_module__ = __webpack_require__(506);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__app_component__ = __webpack_require__(507);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__chart_component__ = __webpack_require__(509);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__dashboard_component__ = __webpack_require__(330);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_9__device_component__ = __webpack_require__(331);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_10__data_service__ = __webpack_require__(215);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__app_routing_module__ = __webpack_require__(507);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__app_component__ = __webpack_require__(508);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__chart_component__ = __webpack_require__(510);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__dashboard_component__ = __webpack_require__(331);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_9__device_component__ = __webpack_require__(333);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_10__detail_component__ = __webpack_require__(332);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_11__data_service__ = __webpack_require__(151);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return AppModule; });
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
@@ -311,6 +367,7 @@ var __metadata = (this && this.__metadata) || function (k, v) {
var AppModule = (function () {
function AppModule() {
}
@@ -320,7 +377,8 @@ var AppModule = (function () {
__WEBPACK_IMPORTED_MODULE_6__app_component__["a" /* AppComponent */],
__WEBPACK_IMPORTED_MODULE_7__chart_component__["a" /* LineChartComponent */],
__WEBPACK_IMPORTED_MODULE_8__dashboard_component__["a" /* DashboardComponent */],
__WEBPACK_IMPORTED_MODULE_9__device_component__["a" /* DeviceComponent */]
__WEBPACK_IMPORTED_MODULE_9__device_component__["a" /* DeviceComponent */],
__WEBPACK_IMPORTED_MODULE_10__detail_component__["a" /* DetailComponent */]
],
imports: [
__WEBPACK_IMPORTED_MODULE_0__angular_platform_browser__["a" /* BrowserModule */],
@@ -329,7 +387,7 @@ var AppModule = (function () {
__WEBPACK_IMPORTED_MODULE_4_ng2_charts_ng2_charts__["ChartsModule"],
__WEBPACK_IMPORTED_MODULE_5__app_routing_module__["a" /* AppRoutingModule */]
],
providers: [__WEBPACK_IMPORTED_MODULE_10__data_service__["a" /* DataService */]],
providers: [__WEBPACK_IMPORTED_MODULE_11__data_service__["a" /* DataService */]],
bootstrap: [__WEBPACK_IMPORTED_MODULE_6__app_component__["a" /* AppComponent */]]
}),
__metadata('design:paramtypes', [])
@@ -340,13 +398,13 @@ var AppModule = (function () {
/***/ }),
/***/ 509:
/***/ 510:
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__data_service__ = __webpack_require__(215);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_ng2_charts_ng2_charts__ = __webpack_require__(369);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__data_service__ = __webpack_require__(151);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_ng2_charts_ng2_charts__ = __webpack_require__(371);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_ng2_charts_ng2_charts___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_ng2_charts_ng2_charts__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return LineChartComponent; });
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
@@ -419,7 +477,7 @@ var LineChartComponent = (function () {
LineChartComponent = __decorate([
__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Component"])({
selector: 'line-chart',
template: __webpack_require__(668)
template: __webpack_require__(669)
}),
__metadata('design:paramtypes', [(typeof (_b = typeof __WEBPACK_IMPORTED_MODULE_1__data_service__["a" /* DataService */] !== 'undefined' && __WEBPACK_IMPORTED_MODULE_1__data_service__["a" /* DataService */]) === 'function' && _b) || Object])
], LineChartComponent);
@@ -430,7 +488,7 @@ var LineChartComponent = (function () {
/***/ }),
/***/ 510:
/***/ 511:
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
@@ -446,48 +504,55 @@ var environment = {
/***/ }),
/***/ 666:
/***/ 667:
/***/ (function(module, exports) {
module.exports = ""
/***/ }),
/***/ 667:
/***/ 668:
/***/ (function(module, exports) {
module.exports = "<div class=\"container\">\r\n\r\n <nav class=\"navbar navbar-default\">\r\n <div class=\"container-fluid\">\r\n <div class=\"navbar-header\">\r\n <button type=\"button\" class=\"navbar-toggle collapsed\" data-toggle=\"collapse\" data-target=\"#navbar\" aria-expanded=\"false\" aria-controls=\"navbar\">\r\n <span class=\"sr-only\">Toggle navigation</span>\r\n <span class=\"icon-bar\"></span>\r\n <span class=\"icon-bar\"></span>\r\n <span class=\"icon-bar\"></span>\r\n </button>\r\n <a class=\"navbar-brand\">Energiemeter</a>\r\n </div>\r\n <div id=\"navbar\" class=\"navbar-collapse collapse\">\r\n <ul class=\"nav navbar-nav\">\r\n <li routerLink=\"/dashboard\" routerLinkActive=\"active\"><a routerLink=\"/dashboard\" routerLinkActive=\"active\">Dashboard</a></li>\r\n <li routerLink=\"/device\" routerLinkActive=\"active\"><a routerLink=\"/device\" routerLinkActive=\"active\">Device</a></li>\r\n </ul>\r\n </div><!--/.nav-collapse -->\r\n </div><!--/.container-fluid -->\r\n </nav>\r\n\r\n <div class=\"row\">\r\n\r\n <div class=\"col-md-12\">\r\n <div class=\"page-header\">\r\n <h1>{{title}} <small>Avans</small></h1>\r\n </div>\r\n </div>\r\n\r\n <router-outlet></router-outlet>\r\n\r\n </div>\r\n</div>\r\n"
/***/ }),
/***/ 668:
/***/ 669:
/***/ (function(module, exports) {
module.exports = "<div class=\"row\">\r\n <div class=\"col-md-6\">\r\n <div style=\"display: block;\">\r\n <canvas baseChart width=\"400\" height=\"400\"\r\n [datasets]=\"lineChartData\"\r\n [labels]=\"lineChartLabels\"\r\n [options]=\"lineChartOptions\"\r\n [colors]=\"lineChartColors\"\r\n [legend]=\"lineChartLegend\"\r\n [chartType]=\"lineChartType\"></canvas>\r\n </div>\r\n </div>\r\n</div>"
/***/ }),
/***/ 669:
/***/ 670:
/***/ (function(module, exports) {
module.exports = "<div>\r\n\t<line-chart></line-chart>\r\n</div>"
/***/ }),
/***/ 670:
/***/ 671:
/***/ (function(module, exports) {
module.exports = "<div>\r\n\r\n<ul>\r\n <li *ngFor=\"let device of devices\">\r\n <span class=\"badge\"> {{device.sn}} </span> {{device.name}}\r\n </li>\r\n</ul>\r\n\r\n</div>"
module.exports = "<div>\r\n\t<line-chart></line-chart>\r\n</div>"
/***/ }),
/***/ 689:
/***/ 672:
/***/ (function(module, exports) {
module.exports = "<div>\r\n\r\n<ul>\r\n <li *ngFor=\"let device of devices\" (click)=\"goToDetails(device.sn)\">\r\n <span class=\"badge\"> {{device.sn}} </span> {{device.name}}\r\n </li>\r\n</ul>\r\n\r\n</div>"
/***/ }),
/***/ 691:
/***/ (function(module, exports, __webpack_require__) {
module.exports = __webpack_require__(388);
module.exports = __webpack_require__(390);
/***/ })
},[689]);
},[691]);
//# sourceMappingURL=main.bundle.map
+1 -1
View File
File diff suppressed because one or more lines are too long
+522 -520
View File
File diff suppressed because it is too large Load Diff
+1 -1
View File
File diff suppressed because one or more lines are too long
+10 -10
View File
@@ -1,15 +1,15 @@
webpackJsonp([2,4],{
/***/ 390:
/***/ 392:
/***/ (function(module, exports, __webpack_require__) {
// style-loader: Adds some css to the DOM by adding a <style> tag
// load the styles
var content = __webpack_require__(661);
var content = __webpack_require__(662);
if(typeof content === 'string') content = [[module.i, content, '']];
// add the styles to the DOM
var update = __webpack_require__(687)(content, {});
var update = __webpack_require__(689)(content, {});
if(content.locals) module.exports = content.locals;
// Hot Module Replacement
if(false) {
@@ -27,10 +27,10 @@ if(false) {
/***/ }),
/***/ 661:
/***/ 662:
/***/ (function(module, exports, __webpack_require__) {
exports = module.exports = __webpack_require__(662)();
exports = module.exports = __webpack_require__(663)();
// imports
@@ -42,7 +42,7 @@ exports.push([module.i, "/* You can add global styles to this file, and also imp
/***/ }),
/***/ 662:
/***/ 663:
/***/ (function(module, exports) {
/*
@@ -99,7 +99,7 @@ module.exports = function() {
/***/ }),
/***/ 687:
/***/ 689:
/***/ (function(module, exports) {
/*
@@ -352,13 +352,13 @@ function updateLink(linkElement, obj) {
/***/ }),
/***/ 691:
/***/ 693:
/***/ (function(module, exports, __webpack_require__) {
module.exports = __webpack_require__(390);
module.exports = __webpack_require__(392);
/***/ })
},[691]);
},[693]);
//# sourceMappingURL=styles.bundle.map
+1 -1
View File
File diff suppressed because one or more lines are too long
+891 -889
View File
File diff suppressed because it is too large Load Diff
+1 -1
View File
File diff suppressed because one or more lines are too long
+3 -1
View File
@@ -2,11 +2,13 @@ import { NgModule } from '@angular/core';
import { RouterModule, Routes } from '@angular/router';
import { DashboardComponent } from './dashboard.component';
import { DeviceComponent } from './device.component';
import { DetailComponent } from './detail.component';
const routes: Routes = [
{ path: '', redirectTo: '/dashboard', pathMatch: 'full' },
{ path: 'dashboard', component: DashboardComponent },
{ path: 'device', component: DeviceComponent }
{ path: 'device', component: DeviceComponent },
{ path: 'detail/:id', component: DetailComponent }
];
@NgModule({
imports: [ RouterModule.forRoot(routes) ],
+3 -1
View File
@@ -10,6 +10,7 @@ import { AppComponent } from './app.component';
import { LineChartComponent } from './chart.component';
import { DashboardComponent } from './dashboard.component';
import { DeviceComponent } from './device.component';
import { DetailComponent } from './detail.component';
import { DataService } from './data.service';
@@ -18,7 +19,8 @@ import { DataService } from './data.service';
AppComponent,
LineChartComponent,
DashboardComponent,
DeviceComponent
DeviceComponent,
DetailComponent
],
imports: [
BrowserModule,
+3
View File
@@ -0,0 +1,3 @@
<div>
<line-chart></line-chart>
</div>
+29
View File
@@ -0,0 +1,29 @@
import { Component, OnInit } from '@angular/core';
import { ActivatedRoute, Params } from '@angular/router';
import { DataService } from './data.service';
@Component({
selector: 'detail',
templateUrl: './detail.component.html'
})
export class DetailComponent implements OnInit {
constructor(private dataService: DataService,
private route: ActivatedRoute) {}
ngOnInit(): void {
let id = this.route.params['id'];
this.dataService
.get(id)
.subscribe(res => {
});
}
}
+1 -1
View File
@@ -1,7 +1,7 @@
<div>
<ul>
<li *ngFor="let device of devices">
<li *ngFor="let device of devices" (click)="goToDetails(device.sn)">
<span class="badge"> {{device.sn}} </span> {{device.name}}
</li>
</ul>
+6 -1
View File
@@ -2,6 +2,7 @@ import { Component, OnInit } from '@angular/core';
import { Device } from './device';
import { DataService } from './data.service';
import { Router } from '@angular/router'
@Component({
selector: 'device',
@@ -12,7 +13,7 @@ export class DeviceComponent implements OnInit {
public devices:Device[];
constructor(private dataService: DataService) {}
constructor(private router: Router, private dataService: DataService) {}
ngOnInit(): void {
@@ -26,4 +27,8 @@ export class DeviceComponent implements OnInit {
}
goToDetail(id:string): void {
this.router.navigate(['/detail', id]);
}
}