2016-10-04 33 views

回答

0

您正在關閉模態。所以,在你的close功能邏輯放置代碼來重置值。 您正在使用Component作爲modals,那麼您可以使用lifeCycle鉤子 ngOnDestroy重置這些值。希望這可以幫助。

0

您的問題描述非常差。但爲什麼不直接使用,只是讓用戶與模型副本交互?一些僞代碼:

function onOpen() { 
    this.tempModel = Object.assign({}, this.realModel); 
    //or if you modal creates a new entity 
    //this.tempModel = {}; 
} 

function onReset() { 
    //do nothing 
} 

function onSave() { 
    this.realModel = this.tempModel 
}