8 changed files with 108 additions and 62 deletions
@ -0,0 +1,25 @@ |
|||||||
|
import { async, ComponentFixture, TestBed } from '@angular/core/testing'; |
||||||
|
|
||||||
|
import { RecordsNavComponent } from './records-nav.component'; |
||||||
|
|
||||||
|
describe('RecordsNavComponent', () => { |
||||||
|
let component: RecordsNavComponent; |
||||||
|
let fixture: ComponentFixture<RecordsNavComponent>; |
||||||
|
|
||||||
|
beforeEach(async(() => { |
||||||
|
TestBed.configureTestingModule({ |
||||||
|
declarations: [ RecordsNavComponent ] |
||||||
|
}) |
||||||
|
.compileComponents(); |
||||||
|
})); |
||||||
|
|
||||||
|
beforeEach(() => { |
||||||
|
fixture = TestBed.createComponent(RecordsNavComponent); |
||||||
|
component = fixture.componentInstance; |
||||||
|
fixture.detectChanges(); |
||||||
|
}); |
||||||
|
|
||||||
|
it('should create', () => { |
||||||
|
expect(component).toBeTruthy(); |
||||||
|
}); |
||||||
|
}); |
@ -0,0 +1,22 @@ |
|||||||
|
import { Injectable } from '@angular/core'; |
||||||
|
import { Observable, ReplaySubject } from 'rxjs'; |
||||||
|
|
||||||
|
@Injectable({ |
||||||
|
providedIn: 'root' |
||||||
|
}) |
||||||
|
export class SelectedMenu { |
||||||
|
|
||||||
|
constructor() { } |
||||||
|
private _sendMessage: ReplaySubject<any> = new ReplaySubject<any>(1); |
||||||
|
/** * 向其他组件发送信息 ** |
||||||
|
* @param message 需要发送的信息 * |
||||||
|
* @returns {Observavle<any>} */ |
||||||
|
|
||||||
|
public sendMessage(message: any) { |
||||||
|
this._sendMessage.next(message); |
||||||
|
} |
||||||
|
|
||||||
|
public getMessage(): Observable<any> { |
||||||
|
return this._sendMessage.asObservable(); |
||||||
|
} |
||||||
|
} |
Loading…
Reference in new issue