我有兩個組件,如下所示,我想從另一個組件調用一個函數。 component1是父節點,即appcomponent,組件2實際上是一個子路由組件。從angular2中的路由器組件調用父組件功能
父Component 1:
@component(
selector:'my-app'
)
export class com1{
function1(){...}
}
孩子航線子項目2:
@component(
selector:'com2'
)
export class com2{
function2(){...
// i want to call function 1 from com1 here
}
}
我使用事件發射器等嘗試,但它不工作。可誰能幫助?這個設置基本上是認證呼叫登錄框,如果沒有認證,如果有什麼我需要知道的,也會有所幫助
@Gunter你能幫助我在這裏http://stackoverflow.com/questions/37864860/how-to-maintain-ui-state-on-model-change-in- angular2 – noobProgrammer