我有一个名为CustomerInfoModule的功能模块,它导出一个CustomerInfoComponent.见下文.
import {NgModule} from '@angular/core'
import {RouterModule} from '@angular/router'
import {CustomerInfoComponent} from './customer-info.component'
@NgModule({
declarations:[CustomerInfoComponent],
exports:[CustomerInfoComponent]
})
export class CustomerInfoModule{
}
Run Code Online (Sandbox Code Playgroud)
我想在MissedCollectionsComponent中导入和使用此CustomerInfoComponent.我收到打字稿错误
'.module''没有导出的成员'CustomerInfoComponent'
.
import {NgModule} from '@angular/core'
import {RouterModule} from '@angular/router'
import {MissedCollectionsComponent} from './missed-collections.component'
import {CustomerInfoComponent} from '../shared/customer/customer-info.module'
@NgModule({
imports:[RouterModule.forChild([
{path:'missedcollection',component:MissedCollectionsComponent},
{path:'missedcollection/customerinfo',component:CustomerInfoComponent}
]),
CustomerInfoModule],
declarations:[],
exports:[]
})
export class MissedCollectionsModule{
}
Run Code Online (Sandbox Code Playgroud)
根据Angular2文档,它说:
"我们导出ContactComponent,以便导入ContactModule的其他模块可以将其包含在组件模板中." 链接
从模块导入组件并在另一个模块中使用它是不合逻辑的.我错误地认为/或缺少某些东西?
我是多线程新手,在阅读多线程时,想到编写这个花哨的多线程代码来执行以下操作.
我的柜台课程如下.
class Counter {
private int c = 0;
public void increment() {
System.out.println("increment value: "+c);
c++;
}
public void decrement() {
c--;
System.out.println("decrement value: "+c);
}
public int value() {
return c;
}
}
Run Code Online (Sandbox Code Playgroud)
此Counter对象在两个线程之间共享.一旦线程启动,我需要执行以下操作.我希望Thread2等到Thread1将Counter对象的计数递增1.一旦完成,然后线程1通知thread2然后Thread1开始等待thread2将值递减1.然后thread2启动并递减值1和再次通知thread1然后thread2开始等待thread1.重复此过程几次.
我怎样才能做到这一点.提前谢谢了.
我做了以下事情.
public class ConcurrencyExample {
private static Counter counter;
private static DecrementCount t1;
private static IncrementCount t2;
public static void main(String[] args) {
Counter counter = new Counter();
Thread t1 = new Thread(new IncrementCount(counter));
t1.start();
Thread t2 = new Thread(new DecrementCount(counter));
t2.start(); …Run Code Online (Sandbox Code Playgroud)