在这里,我有自己的模块,我想从 foo 模块范围之外访问我的路线 foo-detail。
//app/bar/foo/foo.module.ts
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { FooComponent } from './foo.component';
import { FooRoutingModule } from './foo.routing';
import { DetailFoo } from './detailFoo/detailFoo.component';
import { ListFooComponent } from './listFoo/listFoo.component';
@NgModule({
imports: [
CommonModule,
FooRoutingModule
],
declarations: [
FooComponent,
DetailFoo,
ListFooComponent
]
})
export declare class FooModule {}
Run Code Online (Sandbox Code Playgroud)
以及它自己的路由文件
//app/bar/foo/foo.routing.ts
import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
import { FooComponent } from './foo.component'; …Run Code Online (Sandbox Code Playgroud) 我想用ssh中的SquirreL工具连接到我的数据库.可能吗?可悲的是,我没有其他选择这个服务器,所以如果它不工作我将不得不更改工具.
我有以下错误:
错误:未捕获(承诺):类型错误:无法设置未定义的属性“test_id”类型错误:无法设置未定义的属性“test_id”
错误是在这一行上触发的:
console.log('after view init testList', this.productList.test_id);
Run Code Online (Sandbox Code Playgroud)
我看到了很多帖子,但所有帖子似乎都过时了,而且大多数帖子都说我必须使用我使用的函数 ngAfterViewInit。我有一个触发 updateTestId 的 clic 操作,我想将此 ID 传递给我的子视图 ProductListComponent。这是我的父组件:
import { Component,ViewChild} from '@angular/core';
import {Test,TestData} from './testService';
import { LocalDataSource } from 'ng2-smart-table';
import {ProductListComponent} from '../../components/product/list/productList.component';
@Component({
selector: 'test-list',
templateUrl: './testList.html',
styleUrls: ['./testList.scss']
})
export class TestListComponent{
//tests: Test[];
tests: any[];
selected_test : number;
@ViewChild(ProductListComponent)
private productList: ProductListComponent;
constructor(protected service: TestData){
this.service.getData().then((data) => {
this.tests = data.tests;
this.source.load(data);
});
}
settings = {
editable : false,
actions: {
add:false,
edit:false, …Run Code Online (Sandbox Code Playgroud)