mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-15 17:42:15 +08:00
style(lint): fix lint errors
This commit is contained in:
@ -16,8 +16,8 @@ import { setIonicClasses } from './util/set-ionic-classes';
|
||||
})
|
||||
export class BooleanValueAccessor implements ControlValueAccessor {
|
||||
constructor(private element: ElementRef, private renderer: Renderer2) {
|
||||
this.onChange = () => { };
|
||||
this.onTouched = () => { };
|
||||
this.onChange = () => {/**/};
|
||||
this.onTouched = () => {/**/};
|
||||
}
|
||||
|
||||
onChange: (value: any) => void;
|
||||
|
@ -16,8 +16,8 @@ import { setIonicClasses } from './util/set-ionic-classes';
|
||||
})
|
||||
export class NumericValueAccessor implements ControlValueAccessor {
|
||||
constructor(private element: ElementRef, private renderer: Renderer2) {
|
||||
this.onChange = () => { };
|
||||
this.onTouched = () => { };
|
||||
this.onChange = () => {/**/};
|
||||
this.onTouched = () => {/**/};
|
||||
}
|
||||
|
||||
onChange: (value: any) => void;
|
||||
|
@ -21,8 +21,8 @@ export class RadioValueAccessor implements ControlValueAccessor {
|
||||
onTouched: () => void;
|
||||
|
||||
constructor(private element: ElementRef, private renderer: Renderer2) {
|
||||
this.onChange = () => { };
|
||||
this.onTouched = () => { };
|
||||
this.onChange = () => {/**/};
|
||||
this.onTouched = () => {/**/};
|
||||
}
|
||||
|
||||
writeValue(value: any) {
|
||||
|
@ -18,8 +18,8 @@ import { setIonicClasses } from './util/set-ionic-classes';
|
||||
})
|
||||
export class SelectValueAccessor implements ControlValueAccessor {
|
||||
constructor(private element: ElementRef, private renderer: Renderer2) {
|
||||
this.onChange = () => { };
|
||||
this.onTouched = () => { };
|
||||
this.onChange = () => {/**/};
|
||||
this.onTouched = () => {/**/};
|
||||
}
|
||||
|
||||
onChange: (value: any) => void;
|
||||
|
@ -16,8 +16,8 @@ import { setIonicClasses } from './util/set-ionic-classes';
|
||||
})
|
||||
export class TextValueAccessor implements ControlValueAccessor {
|
||||
constructor(private element: ElementRef, private renderer: Renderer2) {
|
||||
this.onChange = () => { };
|
||||
this.onTouched = () => { };
|
||||
this.onChange = () => {/**/};
|
||||
this.onTouched = () => {/**/};
|
||||
}
|
||||
|
||||
onChange: (value: any) => void;
|
||||
|
@ -25,7 +25,7 @@ export function getProviders(element: HTMLElement, data: any) {
|
||||
{
|
||||
provide: NavParams, useFactory: provideNavParamsInjectable, deps: [NavParamsToken]
|
||||
},
|
||||
]
|
||||
];
|
||||
}
|
||||
|
||||
export function provideNavControllerInjectable(element: HTMLIonNavElement) {
|
||||
|
@ -3,7 +3,6 @@ import {
|
||||
Directive,
|
||||
ElementRef,
|
||||
Injector,
|
||||
Optional,
|
||||
Type,
|
||||
} from '@angular/core';
|
||||
|
||||
@ -11,8 +10,6 @@ import { FrameworkDelegate } from '@ionic/core';
|
||||
|
||||
import { AngularComponentMounter, AngularEscapeHatch } from '..';
|
||||
|
||||
let id = 0;
|
||||
|
||||
@Directive({
|
||||
selector: 'ion-nav',
|
||||
})
|
||||
@ -45,4 +42,4 @@ export class IonNav implements FrameworkDelegate {
|
||||
return this.angularComponentMounter.removeViewFromDom(parentElement, childElement);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { EmbeddedViewRef, AfterContentInit, ContentChild, Directive, ElementRef, Input, IterableDiffers, TrackByFunction, ChangeDetectorRef } from '@angular/core';
|
||||
import { ChangeDetectorRef, ContentChild, Directive, ElementRef, EmbeddedViewRef } from '@angular/core';
|
||||
import { VirtualItem } from './virtual-item';
|
||||
import { VirtualHeader } from './virtual-header';
|
||||
import { VirtualFooter } from './virtual-footer';
|
||||
@ -15,7 +15,7 @@ export class VirtualScroll {
|
||||
|
||||
constructor(
|
||||
private el: ElementRef,
|
||||
private cd: ChangeDetectorRef,
|
||||
public cd: ChangeDetectorRef,
|
||||
) {
|
||||
this.el.nativeElement.itemRender = this.itemRender.bind(this);
|
||||
}
|
||||
@ -39,7 +39,7 @@ export class VirtualScroll {
|
||||
}
|
||||
|
||||
private getComponent(type: number) {
|
||||
switch(type) {
|
||||
switch (type) {
|
||||
case 0: return this.itmTmp.templateRef;
|
||||
case 1: return this.hdrTmp.templateRef;
|
||||
case 2: return this.ftrTmp.templateRef;
|
||||
@ -50,7 +50,7 @@ export class VirtualScroll {
|
||||
|
||||
function getElement(view: EmbeddedViewRef<VirtualContext>): HTMLElement {
|
||||
const rootNodes = view.rootNodes;
|
||||
for (var i = 0; i < rootNodes.length; i++) {
|
||||
for (let i = 0; i < rootNodes.length; i++) {
|
||||
if (rootNodes[i].nodeType === 1) {
|
||||
return rootNodes[i];
|
||||
}
|
||||
|
@ -28,4 +28,4 @@ export { Platform } from './providers/platform';
|
||||
export { PopoverController, PopoverProxy } from './providers/popover-controller';
|
||||
export { ToastController, ToastProxy } from './providers/toast-controller';
|
||||
|
||||
export * from './types/interfaces';
|
||||
export * from './types/interfaces';
|
||||
|
@ -1,8 +1,8 @@
|
||||
import { CommonModule } from '@angular/common';
|
||||
import {
|
||||
CUSTOM_ELEMENTS_SCHEMA,
|
||||
ModuleWithProviders,
|
||||
NgModule,
|
||||
CUSTOM_ELEMENTS_SCHEMA
|
||||
NgModule
|
||||
} from '@angular/core';
|
||||
|
||||
import { BooleanValueAccessor } from './control-value-accessors/boolean-value-accessor';
|
||||
|
@ -12,20 +12,20 @@ export class ActionSheetController {
|
||||
}
|
||||
}
|
||||
|
||||
export function getActionSheetProxy(opts: ActionSheetOptions){
|
||||
export function getActionSheetProxy(opts: ActionSheetOptions) {
|
||||
return {
|
||||
id: actionSheetId++,
|
||||
state: PRESENTING,
|
||||
opts: opts,
|
||||
present: function() { return present(this)},
|
||||
dismiss: function() { return dismiss(this)},
|
||||
present: function() { return present(this); },
|
||||
dismiss: function() { return dismiss(this); },
|
||||
onDidDismiss: function(callback: (data: any, role: string) => void) {
|
||||
(this as ActionSheetProxyInternal).onDidDismissHandler = callback;
|
||||
},
|
||||
onWillDismiss: function(callback: (data: any, role: string) => void) {
|
||||
(this as ActionSheetProxyInternal).onWillDismissHandler = callback;
|
||||
},
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
export function present(actionSheetProxy: ActionSheetProxyInternal): Promise<any> {
|
||||
@ -82,8 +82,8 @@ export function loadOverlay(opts: ActionSheetOptions): Promise<HTMLIonActionShee
|
||||
}
|
||||
|
||||
export interface ActionSheetProxy {
|
||||
present(): Promise<void>
|
||||
dismiss(): Promise<void>
|
||||
present(): Promise<void>;
|
||||
dismiss(): Promise<void>;
|
||||
onDidDismiss(callback: (data: any, role: string) => void): void;
|
||||
onWillDismiss(callback: (data: any, role: string) => void): void;
|
||||
}
|
||||
@ -101,4 +101,4 @@ export const PRESENTING = 1;
|
||||
export const DISMISSING = 2;
|
||||
|
||||
const ION_ACTION_SHEET_DID_DISMISS_EVENT = 'ionActionSheetDidDismiss';
|
||||
const ION_ACTION_SHEET_WILL_DISMISS_EVENT = 'ionActionSheetWillDismiss';
|
||||
const ION_ACTION_SHEET_WILL_DISMISS_EVENT = 'ionActionSheetWillDismiss';
|
||||
|
@ -12,20 +12,20 @@ export class AlertController {
|
||||
}
|
||||
}
|
||||
|
||||
export function getAlertProxy(opts: AlertOptions){
|
||||
export function getAlertProxy(opts: AlertOptions) {
|
||||
return {
|
||||
id: alertId++,
|
||||
state: PRESENTING,
|
||||
opts: opts,
|
||||
present: function() { return present(this)},
|
||||
dismiss: function() { return dismiss(this)},
|
||||
present: function() { return present(this); },
|
||||
dismiss: function() { return dismiss(this); },
|
||||
onDidDismiss: function(callback: (data: any, role: string) => void) {
|
||||
(this as AlertProxyInternal).onDidDismissHandler = callback;
|
||||
},
|
||||
onWillDismiss: function(callback: (data: any, role: string) => void) {
|
||||
(this as AlertProxyInternal).onWillDismissHandler = callback;
|
||||
},
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
export function present(alertProxy: AlertProxyInternal): Promise<any> {
|
||||
@ -82,8 +82,8 @@ export function loadOverlay(opts: AlertOptions): Promise<HTMLIonAlertElement> {
|
||||
}
|
||||
|
||||
export interface AlertProxy {
|
||||
present(): Promise<void>
|
||||
dismiss(): Promise<void>
|
||||
present(): Promise<void>;
|
||||
dismiss(): Promise<void>;
|
||||
onDidDismiss(callback: (data: any, role: string) => void): void;
|
||||
onWillDismiss(callback: (data: any, role: string) => void): void;
|
||||
}
|
||||
@ -101,4 +101,4 @@ export const PRESENTING = 1;
|
||||
export const DISMISSING = 2;
|
||||
|
||||
const ION_ALERT_DID_DISMISS_EVENT = 'ionAlertDidDismiss';
|
||||
const ION_ALERT_WILL_DISMISS_EVENT = 'ionAlertWillDismiss';
|
||||
const ION_ALERT_WILL_DISMISS_EVENT = 'ionAlertWillDismiss';
|
||||
|
@ -90,4 +90,4 @@ export function getNavByIdOrNameAsyncImpl(app: App, nameOrId: number | string):
|
||||
return app._element.componentOnReady().then(() => {
|
||||
return app._element.getNavByIdOrName(nameOrId);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -30,4 +30,4 @@ function getElement(): Promise<HTMLIonEventsElement> {
|
||||
});
|
||||
}
|
||||
|
||||
const ELEMENT_NAME = 'ion-events';
|
||||
const ELEMENT_NAME = 'ion-events';
|
||||
|
@ -12,20 +12,20 @@ export class LoadingController {
|
||||
}
|
||||
}
|
||||
|
||||
export function getLoadingProxy(opts: LoadingOptions){
|
||||
export function getLoadingProxy(opts: LoadingOptions) {
|
||||
return {
|
||||
id: loadingId++,
|
||||
state: PRESENTING,
|
||||
opts: opts,
|
||||
present: function() { return present(this)},
|
||||
dismiss: function() { return dismiss(this)},
|
||||
present: function() { return present(this); },
|
||||
dismiss: function() { return dismiss(this); },
|
||||
onDidDismiss: function(callback: (data: any, role: string) => void) {
|
||||
(this as LoadingProxyInternal).onDidDismissHandler = callback;
|
||||
},
|
||||
onWillDismiss: function(callback: (data: any, role: string) => void) {
|
||||
(this as LoadingProxyInternal).onWillDismissHandler = callback;
|
||||
},
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
export function present(loadingProxy: LoadingProxyInternal): Promise<any> {
|
||||
@ -82,8 +82,8 @@ export function loadOverlay(opts: LoadingOptions): Promise<HTMLIonLoadingElement
|
||||
}
|
||||
|
||||
export interface LoadingProxy {
|
||||
present(): Promise<void>
|
||||
dismiss(): Promise<void>
|
||||
present(): Promise<void>;
|
||||
dismiss(): Promise<void>;
|
||||
onDidDismiss(callback: (data: any, role: string) => void): void;
|
||||
onWillDismiss(callback: (data: any, role: string) => void): void;
|
||||
}
|
||||
@ -101,4 +101,4 @@ export const PRESENTING = 1;
|
||||
export const DISMISSING = 2;
|
||||
|
||||
const ION_LOADING_DID_DISMISS_EVENT = 'ionLoadingDidDismiss';
|
||||
const ION_LOADING_WILL_DISMISS_EVENT = 'ionLoadingWillDismiss';
|
||||
const ION_LOADING_WILL_DISMISS_EVENT = 'ionLoadingWillDismiss';
|
||||
|
@ -93,7 +93,7 @@ export class MenuController {
|
||||
return false;
|
||||
}
|
||||
|
||||
isOpenAsync(menuId?: string): Promise<boolean>{
|
||||
isOpenAsync(menuId?: string): Promise<boolean> {
|
||||
return element.componentOnReady().then(() => {
|
||||
return element.isOpen(menuId);
|
||||
});
|
||||
@ -124,4 +124,4 @@ export class MenuController {
|
||||
return element.toggle(menuId);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -120,4 +120,4 @@ export class NavController implements PublicNav {
|
||||
}
|
||||
return [];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -5,7 +5,7 @@ export type DocumentDirection = 'ltr' | 'rtl';
|
||||
|
||||
let dir: DocumentDirection = 'ltr';
|
||||
let isRtl = false;
|
||||
let lang: string = '';
|
||||
let lang = '';
|
||||
|
||||
export class Platform {
|
||||
|
||||
@ -225,4 +225,4 @@ export function getHydratedPlatform(platform: Platform): Promise<HTMLIonPlatform
|
||||
});
|
||||
}
|
||||
return platform._element.componentOnReady();
|
||||
}
|
||||
}
|
||||
|
@ -12,20 +12,20 @@ export class ToastController {
|
||||
}
|
||||
}
|
||||
|
||||
export function getToastProxy(opts: ToastOptions){
|
||||
export function getToastProxy(opts: ToastOptions) {
|
||||
return {
|
||||
id: toastId++,
|
||||
state: PRESENTING,
|
||||
opts: opts,
|
||||
present: function() { return present(this)},
|
||||
dismiss: function() { return dismiss(this)},
|
||||
present: function() { return present(this); },
|
||||
dismiss: function() { return dismiss(this); },
|
||||
onDidDismiss: function(callback: (data: any, role: string) => void) {
|
||||
(this as ToastProxyInternal).onDidDismissHandler = callback;
|
||||
},
|
||||
onWillDismiss: function(callback: (data: any, role: string) => void) {
|
||||
(this as ToastProxyInternal).onWillDismissHandler = callback;
|
||||
},
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
export function present(toastProxy: ToastProxyInternal): Promise<any> {
|
||||
@ -82,8 +82,8 @@ export function loadOverlay(opts: ToastOptions): Promise<HTMLIonToastElement> {
|
||||
}
|
||||
|
||||
export interface ToastProxy {
|
||||
present(): Promise<void>
|
||||
dismiss(): Promise<void>
|
||||
present(): Promise<void>;
|
||||
dismiss(): Promise<void>;
|
||||
onDidDismiss(callback: (data: any, role: string) => void): void;
|
||||
onWillDismiss(callback: (data: any, role: string) => void): void;
|
||||
}
|
||||
@ -101,4 +101,4 @@ export const PRESENTING = 1;
|
||||
export const DISMISSING = 2;
|
||||
|
||||
const ION_TOAST_DID_DISMISS_EVENT = 'ionToastDidDismiss';
|
||||
const ION_TOAST_WILL_DISMISS_EVENT = 'ionToastWillDismiss';
|
||||
const ION_TOAST_WILL_DISMISS_EVENT = 'ionToastWillDismiss';
|
||||
|
@ -14,10 +14,10 @@ import {
|
||||
} from '@angular/router';
|
||||
|
||||
import {
|
||||
TreeNode,
|
||||
advanceActivatedRoute,
|
||||
forEach,
|
||||
nodeChildrenAsMap,
|
||||
TreeNode
|
||||
nodeChildrenAsMap
|
||||
} from './router-utils';
|
||||
|
||||
export class AsyncActivateRoutes {
|
||||
@ -64,7 +64,7 @@ export class AsyncActivateRoutes {
|
||||
() => {
|
||||
const promises: Promise<void>[] = [];
|
||||
// De-activate the routes that will not be re-used
|
||||
forEach(children, (v: TreeNode<ActivatedRoute>, childName: string) => {
|
||||
forEach(children, (v: TreeNode<ActivatedRoute>) => {
|
||||
promises.push(this.deactivateRouteAndItsChildren(v, contexts));
|
||||
});
|
||||
|
||||
@ -135,7 +135,7 @@ export class AsyncActivateRoutes {
|
||||
const contexts = route.value.component ? context.children : parentContexts;
|
||||
|
||||
const promises: Promise<void>[] = [];
|
||||
forEach(children, (v: any, k: string) => {
|
||||
forEach(children, (v: any) => {
|
||||
promises.push(this.deactivateRouteAndItsChildren(v, contexts));
|
||||
});
|
||||
|
||||
|
@ -42,7 +42,7 @@ export function monkeyPatchRouter(router: any) {
|
||||
}
|
||||
}
|
||||
|
||||
routes.push(new AsyncActivateRoutes(router.routeReuseStrategy, state, storedState, (evt: Event) => router.triggerEvent(evt)))
|
||||
routes.push(new AsyncActivateRoutes(router.routeReuseStrategy, state, storedState, (evt: Event) => router.triggerEvent(evt)));
|
||||
|
||||
|
||||
})
|
||||
@ -83,7 +83,7 @@ export function monkeyPatchRouter(router: any) {
|
||||
resolvePromise(false);
|
||||
} else {
|
||||
router.resetStateAndUrl(storedState, storedUrl, rawUrl);
|
||||
(router.events as any as Subject<Event>)
|
||||
(router.events as Subject<Event>)
|
||||
.next(new NavigationError(id, router.serializeUrl(url), e));
|
||||
try {
|
||||
resolvePromise(router.errorHandler(e));
|
||||
@ -100,4 +100,4 @@ function isNavigationCancelingError(error: any) {
|
||||
return error && (/** @type {?} */ (error))[NAVIGATION_CANCELING_ERROR];
|
||||
}
|
||||
|
||||
const NAVIGATION_CANCELING_ERROR = 'ngNavigationCancelingError';
|
||||
const NAVIGATION_CANCELING_ERROR = 'ngNavigationCancelingError';
|
||||
|
@ -20,4 +20,4 @@ export class OutletInjector implements Injector {
|
||||
|
||||
return this.parent.get(token, notFoundValue);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -7,7 +7,6 @@ import {
|
||||
ElementRef,
|
||||
EventEmitter,
|
||||
Injector,
|
||||
NgZone,
|
||||
OnDestroy,
|
||||
OnInit,
|
||||
Output,
|
||||
@ -16,13 +15,13 @@ import {
|
||||
} from '@angular/core';
|
||||
|
||||
import {
|
||||
PRIMARY_OUTLET,
|
||||
ActivatedRoute,
|
||||
ChildrenOutletContexts,
|
||||
PRIMARY_OUTLET,
|
||||
Router
|
||||
} from '@angular/router';
|
||||
|
||||
import { NavResult, RouterDelegate } from '@ionic/core';
|
||||
import { RouterDelegate } from '@ionic/core';
|
||||
|
||||
import { OutletInjector } from './outlet-injector';
|
||||
import { RouteEventHandler } from './route-event-handler';
|
||||
@ -179,7 +178,7 @@ export function getDataFromRoute(activatedRoute: ActivatedRoute): Promise<any> {
|
||||
promises.push(getDataFromObservable(activatedRoute));
|
||||
promises.push(getDataFromParams(activatedRoute));
|
||||
return Promise.all(promises).then(([data, params]: any[]) => {
|
||||
let combined = {};
|
||||
const combined = {};
|
||||
Object.assign(combined, data, params);
|
||||
return combined;
|
||||
});
|
||||
@ -199,4 +198,4 @@ export function getDataFromParams(activatedRoute: ActivatedRoute) {
|
||||
resolve(data || {});
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -38,4 +38,4 @@ export interface PushPopOutletContext {
|
||||
resolver?: ComponentFactoryResolver;
|
||||
children?: PushPopOutletContexts;
|
||||
attachRef: ComponentRef<any>;
|
||||
}
|
||||
}
|
||||
|
@ -10,7 +10,7 @@ import { getIonApp } from '../util/util';
|
||||
@Injectable()
|
||||
export class RouteEventHandler {
|
||||
|
||||
constructor(private router: Router) {
|
||||
constructor(public router: Router) {
|
||||
|
||||
router.events.subscribe((event: Event) => {
|
||||
if (event instanceof NavigationEnd) {
|
||||
|
@ -15,13 +15,13 @@ import {
|
||||
import {ɵgetDOM as getDOM} from '@angular/platform-browser';
|
||||
|
||||
import {
|
||||
ROUTES,
|
||||
ROUTER_CONFIGURATION,
|
||||
ChildrenOutletContexts,
|
||||
ExtraOptions,
|
||||
ROUTER_CONFIGURATION,
|
||||
ROUTES,
|
||||
Route,
|
||||
Router,
|
||||
RouteReuseStrategy,
|
||||
Router,
|
||||
UrlHandlingStrategy,
|
||||
UrlSerializer
|
||||
} from '@angular/router';
|
||||
@ -70,7 +70,7 @@ export class IonicRouterModule {
|
||||
}
|
||||
|
||||
export function setupRouter(
|
||||
ref: ApplicationRef, urlSerializer: UrlSerializer, contexts: ChildrenOutletContexts,
|
||||
_ref: ApplicationRef, urlSerializer: UrlSerializer, contexts: ChildrenOutletContexts,
|
||||
location: Location, injector: Injector, loader: NgModuleFactoryLoader, compiler: Compiler,
|
||||
config: Route[][], opts: ExtraOptions = {}, urlHandlingStrategy?: UrlHandlingStrategy,
|
||||
routeReuseStrategy?: RouteReuseStrategy) {
|
||||
@ -96,7 +96,7 @@ if (opts.errorHandler) {
|
||||
if (opts.enableTracing) {
|
||||
const dom = getDOM();
|
||||
router.events.subscribe((e: any) => {
|
||||
dom.logGroup(`Router Event: ${(<any>e.constructor).name}`);
|
||||
dom.logGroup(`Router Event: ${(e.constructor).name}`);
|
||||
dom.log(e.toString());
|
||||
dom.log(e);
|
||||
dom.logGroupEnd();
|
||||
@ -112,4 +112,4 @@ if (opts.paramsInheritanceStrategy) {
|
||||
}
|
||||
|
||||
return router;
|
||||
}
|
||||
}
|
||||
|
@ -8,7 +8,7 @@ export function nodeChildrenAsMap<T extends{outlet: string}>(node: TreeNode<T>|
|
||||
return map;
|
||||
}
|
||||
|
||||
export function forEach<K, V>(map: {[key: string]: V}, callback: (v: V, k: string) => void): void {
|
||||
export function forEach<_K, V>(map: {[key: string]: V}, callback: (v: V, k: string) => void): void {
|
||||
for (const prop in map) {
|
||||
if (map.hasOwnProperty(prop)) {
|
||||
callback(map[prop], prop);
|
||||
@ -30,28 +30,28 @@ export class TreeNode<T> {
|
||||
export function advanceActivatedRoute(route: any): void {
|
||||
if (route.snapshot) {
|
||||
const currentSnapshot = route.snapshot;
|
||||
const nextSnapshot = (route as any)._futureSnapshot;
|
||||
const nextSnapshot = (route)._futureSnapshot;
|
||||
route.snapshot = nextSnapshot;
|
||||
if (!shallowEqual(currentSnapshot.queryParams, nextSnapshot.queryParams)) {
|
||||
(<any>route.queryParams).next(nextSnapshot.queryParams);
|
||||
(route.queryParams).next(nextSnapshot.queryParams);
|
||||
}
|
||||
if (currentSnapshot.fragment !== nextSnapshot.fragment) {
|
||||
(<any>route.fragment).next(nextSnapshot.fragment);
|
||||
(route.fragment).next(nextSnapshot.fragment);
|
||||
}
|
||||
if (!shallowEqual(currentSnapshot.params, nextSnapshot.params)) {
|
||||
(<any>route.params).next(nextSnapshot.params);
|
||||
(route.params).next(nextSnapshot.params);
|
||||
}
|
||||
if (!shallowEqualArrays(currentSnapshot.url, nextSnapshot.url)) {
|
||||
(<any>route.url).next(nextSnapshot.url);
|
||||
(route.url).next(nextSnapshot.url);
|
||||
}
|
||||
if (!shallowEqual(currentSnapshot.data, nextSnapshot.data)) {
|
||||
(<any>route.data).next(nextSnapshot.data);
|
||||
(route.data).next(nextSnapshot.data);
|
||||
}
|
||||
} else {
|
||||
route.snapshot = (route as any)._futureSnapshot;
|
||||
route.snapshot = (route)._futureSnapshot;
|
||||
|
||||
// this is for resolved data
|
||||
(<any>route.data).next((route as any)._futureSnapshot.data);
|
||||
(route.data).next((route)._futureSnapshot.data);
|
||||
}
|
||||
}
|
||||
|
||||
@ -66,6 +66,7 @@ export function shallowEqualArrays(a: any[], b: any[]): boolean {
|
||||
export function shallowEqual(a: {[x: string]: any}, b: {[x: string]: any}): boolean {
|
||||
const k1 = Object.keys(a);
|
||||
const k2 = Object.keys(b);
|
||||
/*tslint:disable*/
|
||||
if (k1.length != k2.length) {
|
||||
return false;
|
||||
}
|
||||
@ -81,4 +82,4 @@ export function shallowEqual(a: {[x: string]: any}, b: {[x: string]: any}): bool
|
||||
|
||||
export function flatten<T>(arr: T[][]): T[] {
|
||||
return Array.prototype.concat.apply([], arr);
|
||||
}
|
||||
}
|
||||
|
@ -20,4 +20,4 @@ export interface AngularEscapeHatch extends EscapeHatch {
|
||||
activatedRoute?: ActivatedRoute;
|
||||
cfr?: ComponentFactoryResolver;
|
||||
injector?: Injector;
|
||||
}
|
||||
}
|
||||
|
@ -29,4 +29,4 @@ export function isString(something: any) {
|
||||
export function getIonApp(): Promise<HTMLIonAppElement> {
|
||||
const element = ensureElementInBody('ion-app') as HTMLIonAppElement;
|
||||
return element.componentOnReady();
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user