切换路线时 如何保持应用程序的状态?我发现每次切换标签时都会重新初始化Angular类.
例如. Plunker
import {Component, View, CORE_DIRECTIVES} from 'angular2/angular2'
@Component({
})
@View({
template: `
<input class="form-control" [value]="test"> </input>
<br>
{{test}}
`
})
export class SearchPage{
test = `Type something here go to inventory tab and comeback to search tab. Typed data will gone.
I observed that Angular class is reinitialize every time I switch tabs.`;
}
}
Run Code Online (Sandbox Code Playgroud) angular ×1