当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript Location.subscribe方法代码示例

本文整理汇总了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', '[]'));
     })
 }
开发者ID:jfbourne,项目名称:native-script,代码行数:7,代码来源:index.ts

示例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();
    }
开发者ID:couchbaselabs,项目名称:nativescript-couchbase,代码行数:30,代码来源:list.component.ts

示例3: constructor

 constructor(router: Router, location: Location, private _listService: ListService) {
     this.router = router
     this.service = _listService;
     location.subscribe((path) => {
        this.refresh();
     });
 }
开发者ID:NathanWalker,项目名称:nativescript-couchbase,代码行数:7,代码来源:list.component.ts

示例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")) : [];
     });
   }
开发者ID:caraclarke,项目名称:angular-nativescr-practice,代码行数:12,代码来源:list.component.ts

示例5: ngOnInit

 ngOnInit(){
   this.location.subscribe((v)=>{
     if(v.pop){
         this.location.forward()
     }
   }) 
   this.deploy() 
   this.checkdeploy()    
   
 }
开发者ID:daviddexter,项目名称:wajibu,代码行数:10,代码来源:dash.deploy.component.ts

示例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();
        });
    }
开发者ID:RoRoche,项目名称:NativeScriptStarter,代码行数:11,代码来源:list.component.ts

示例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();
					
				}

			}
		);

	}
开发者ID:bennadel,项目名称:JavaScript-Demos,代码行数:22,代码来源:app.component.ts

示例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")) : [];
   });
 }
开发者ID:caraclarke,项目名称:angular2-nativescript-list,代码行数:11,代码来源:list.component.ts


注:本文中的@angular/common.Location.subscribe方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。