本文整理汇总了TypeScript中@angular/common.Location.subscribe方法的典型用法代码示例。如果您正苦于以下问题:TypeScript Location.subscribe方法的具体用法?TypeScript Location.subscribe怎么用?TypeScript Location.subscribe使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类@angular/common.Location
的用法示例。
在下文中一共展示了Location.subscribe方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: constructor
constructor(router: Router, location: Location){
this.router = router;
this.personList = JSON.parse(ApplicationSettings.getString('people', '[]'));
location.subscribe((path) => {
this.personList = JSON.parse(ApplicationSettings.getString('people', '[]'));
})
}
示例2: constructor
constructor(router: Router, location: Location, ngZone: NgZone, couchbaseInstance: CouchbaseInstance) {
this.router = router;
this.ngZone = ngZone;
this.database = couchbaseInstance.getDatabase();
this.personList = [];
couchbaseInstance.startSync(true);
this.database.addDatabaseChangeListener((changes) => {
let changeIndex;
for (var i = 0; i < changes.length; i++) {
let documentId = changes[i].getDocumentId();
changeIndex = this.indexOfObjectId(documentId, this.personList);
let document = this.database.getDocument(documentId);
this.ngZone.run(() => {
if (changeIndex == -1) {
this.personList.push(document);
} else {
this.personList[changeIndex] = document;
}
});
}
});
location.subscribe((path) => {
this.refresh();
});
this.refresh();
}
示例3: constructor
constructor(router: Router, location: Location, private _listService: ListService) {
this.router = router
this.service = _listService;
location.subscribe((path) => {
this.refresh();
});
}
示例4: constructor
// initializes list
// using localStorage to store data
// parse localStorage data if it exists of use an empty array if it doesnt exist
constructor(private router: Router, private location: Location) {
this.personList = localStorage.getItem("people") != null ? JSON.parse(localStorage.getItem("people")) : [];
// using subscribe method on location object
// listening for pop (backwards) events in navigation stack
// when it happends we can reload from localStorage
this.location.subscribe((path) => {
this.personList = localStorage.getItem("people") != null ? JSON.parse(localStorage.getItem("people")) : [];
});
}
示例5: ngOnInit
ngOnInit(){
this.location.subscribe((v)=>{
if(v.pop){
this.location.forward()
}
})
this.deploy()
this.checkdeploy()
}
示例6: constructor
constructor(pRouter: Router, pLocation: Location) {
this.model = new ListModel();
this.interactor = new ListInteractor();
this.wireframe = new ListWireframe(pRouter, pLocation);
this.loadData();
pLocation.subscribe((path) => {
this.loadData();
});
}
示例7: constructor
// I initialize the app component.
constructor( location: Location ) {
this.location = location;
// While the PopStateEvent won't trigger when we call location.go(), it will
// trigger when we use the HREF-based navigation. Let's listen for those location
// changes that occur due to external changes in the browser URL.
this.location.subscribe(
( event: PopStateEvent ) : void => {
if ( event.type === "hashchange" ) {
console.group( "PopState" );
console.log( event.url );
console.groupEnd();
}
}
);
}
示例8: constructor
// constructor initializes list
// using html5 localStorage to store data
// parse serialized local storage data if it exists otherwise use an empty array
// subscribe method on location we are listening for pop (backwards) event in nav stack
// when this happens we can reload from local storage
constructor(private router: Router, private location: Location) {
this.personList = localStorage.getItem("people") != null ? JSON.parse(localStorage.getItem("people")) : [];
this.location.subscribe((path) => {
this.personList = localStorage.getItem("people") != null ? JSON.parse(localStorage.getItem("people")) : [];
});
}