@angular/common#Location TypeScript Examples
The following examples show how to use
@angular/common#Location.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: base.component.ts From 1x.ag with MIT License | 6 votes |
constructor(
private location: Location,
public navigationService: NavigationService,
private route: ActivatedRoute,
private router: Router,
private configurationService: ConfigurationService,
public themeService: ThemeService,
public web3Service: Web3Service,
public tokenService: TokenService,
private modalService: BsModalService,
protected connectService: ConnectService,
public transactionService: TransactionService
) {
}
Example #2
Source File: user-auth.service.ts From data-annotator-for-machine-learning with Apache License 2.0 | 6 votes |
constructor(
private location: Location,
private http: HttpClient,
private env: EnvironmentsService,
) {
this.jwtHelper = new JwtHelperService();
this.autoRefreshToken(); // autoRefresh validates if the stored token is still valid
const status: SessionStatus = this.loggedUser()
? SessionStatus.AUTHENTICATED
: SessionStatus.NOT_AUTHENTICATED;
this.sessionLifetimeSubject = new BehaviorSubject<SessionStatus>(status);
window.addEventListener('storage', this.storageEventListener.bind(this));
this.userSubject = new BehaviorSubject<AuthUser>(this.loggedUser());
}
Example #3
Source File: header.component.ts From nuxx with GNU Affero General Public License v3.0 | 6 votes |
constructor(private store: Store<AppState>, private eventEmitterService: EventEmitterService, private authenticationService: AuthenticationService, private restService: RestService, private router: Router, private dialog: MatDialog, private location: Location) {
this.project = this.store.select('project')
this.subscription = this.project.pipe(takeUntil(this.unSubscribe$)).subscribe((data) => {
this.mutable = data.mutable
this.name = data.name
this.selectedProject = data
if (this.projects) {
const projectAfterUpdate = this.projects.findIndex(({uuid}) => uuid === data.uuid)
projectAfterUpdate !== -1 ? this.projects[projectAfterUpdate] = { ...data } : ''
}
})
this.authenticationService.currentUser.pipe(takeUntil(this.unSubscribe$)).subscribe((user) => {
this.projects = null
if (user) {
this.restService.getUserProjects().pipe(takeUntil(this.unSubscribe$)).subscribe((response) => {
this.projects = response.results
let projects = []
for (let key in response.results) {
let obj = {
name: response.results[key].name,
uuid: response.results[key].uuid,
mutable: response.results[key].mutable,
...response.results[key].data,
} as Project
projects.push(obj)
}
this.projects = projects
})
}
})
}
Example #4
Source File: go-pro-media-list-on-camera.component.ts From capture-lite with GNU General Public License v3.0 | 6 votes |
constructor(
private readonly location: Location,
private readonly goProMediaService: GoProMediaService,
private readonly router: Router,
private readonly navCtrl: NavController,
private readonly alertCtrl: AlertController,
private readonly goProBluetoothService: GoProBluetoothService,
private readonly goProWifiService: GoProWifiService,
private readonly platform: Platform,
private readonly errorService: ErrorService,
public toastController: ToastController
) {}
Example #5
Source File: tasknew.component.ts From muino-time-management with GNU General Public License v3.0 | 6 votes |
constructor(private formBuilder: FormBuilder,
private route: ActivatedRoute ,
private router: Router,
private taskService: TaskService,
private location: Location) {
/// parrent effe zetten van het project waar hij net vandaag komt
this.NewTaskForm = this.formBuilder.group({
task_name: ['', Validators.required],
description: ['', Validators.required],
start_date: ['', Validators.required],
due_date: ['', Validators.required],
});
}
Example #6
Source File: post-detail.component.ts From mns with MIT License | 6 votes |
// @Irice why should i use ActivatedRoute in this Component?
// @Ghislain this is load the information containing on the post DataBase
constructor(
private router: Router,
private messageService: MessageService, // Fun to use TOAST for i.e. Comment
private activatedRoute: ActivatedRoute, // @Idrice Comments this?
private location: Location, // A service that applications can use to interact with a browser's URL
private blogService: BlogService
) {
// this is a method in the constructor to set the time at which a comment has being posted from the computer time/browser-->
setInterval(() => {
this.now = new Date();
}, 1);
}
Example #7
Source File: send.component.ts From EXOS-Core with MIT License | 6 votes |
constructor(
public readonly appState: ApplicationStateService,
private apiService: ApiService,
private location: Location,
private router: Router,
private wallet: WalletService,
public globalService: GlobalService,
private fb: FormBuilder,
public localeService: LocaleService
) {
this.appState.pageMode = true;
this.buildSendForm();
}
Example #8
Source File: ranking.component.ts From oss-github-benchmark with GNU General Public License v3.0 | 6 votes |
constructor(
private dataService: DataService,
private route: ActivatedRoute,
public dialog: MatDialog,
private location: Location,
fb: FormBuilder
) {
this.sort = new MatSort();
this.sectorFilters.forEach(
(sector: { sector: string; activated: boolean }) => {
if (sector.activated) {
this.checkboxes.push(sector.sector);
}
}
);
}
Example #9
Source File: send.component.ts From blockcore-hub with MIT License | 6 votes |
constructor(
public readonly appState: ApplicationStateService,
public appModes: AppModes,
private apiService: ApiService,
private location: Location,
private router: Router,
private wallet: WalletService,
private globalService: GlobalService,
private fb: FormBuilder
) {
this.appState.pageMode = true;
this.buildSendForm();
}
Example #10
Source File: auth.component.ts From ngx-admin-dotnet-starter with MIT License | 6 votes |
// showcase of how to use the onAuthenticationChange method
constructor(protected auth: NbAuthService, protected location: Location) {
this.subscription = auth.onAuthenticationChange()
.pipe(takeWhile(() => this.alive))
.subscribe((authenticated: boolean) => {
this.authenticated = authenticated;
});
}
Example #11
Source File: base.component.ts From 1hop with MIT License | 6 votes |
constructor(
private location: Location,
public navigationService: NavigationService,
private route: ActivatedRoute,
private router: Router,
private configurationService: ConfigurationService,
public themeService: ThemeService,
public web3Service: Web3Service,
private modalService: BsModalService,
protected connectService: ConnectService,
public transactionService: TransactionService,
public tokenService: TokenService
) {
}
Example #12
Source File: team-details.component.ts From worktez with MIT License | 5 votes |
constructor(private applicationSettingsService: ApplicationSettingsService, private startService: StartServiceService, private userService: UserServiceService, private location: Location, private backendService: BackendService, private route: ActivatedRoute, private navbarHandler: NavbarHandlerService, private functions: AngularFireFunctions, public errorHandlerService: ErrorHandlerService) { }
Example #13
Source File: user-ranking.component.ts From oss-github-benchmark with GNU General Public License v3.0 | 5 votes |
constructor(
private dataService: DataService,
private location: Location,
private route: ActivatedRoute
) {}
Example #14
Source File: go-back.directive.ts From dating-client with MIT License | 5 votes |
constructor(private location: Location, private router: Router) { }
Example #15
Source File: create-new-team.component.ts From worktez with MIT License | 5 votes |
constructor(private startService: StartServiceService, private applicationSettingsService: ApplicationSettingsService, private navbarService: NavbarHandlerService, private functions: AngularFireFunctions, public validationService: ValidationService, private router: Router,private authService: AuthService, private location: Location, public applicationSettings: ApplicationSettingsService, public backendService: BackendService, public toolsService: ToolsService, public popUpHandlerService: PopupHandlerService, public errorHandlerService: ErrorHandlerService) { }
Example #16
Source File: router-link-back.directive.ts From EXOS-Core with MIT License | 5 votes |
constructor(private location: Location, private router: Router) { }
Example #17
Source File: csv.component.ts From labely with GNU General Public License v3.0 | 5 votes |
constructor(private location: Location, private route: Router, private labelyService: LabelyService) {}
Example #18
Source File: router.effects.ts From geonetwork-ui with GNU General Public License v2.0 | 5 votes |
constructor(
private _actions$: Actions,
private _router: Router,
private _location: Location,
private facade: RouterFacade,
@Inject(ROUTER_CONFIG) private routerConfig: RouterConfigModel
) {}
Example #19
Source File: create-new-organization.component.ts From worktez with MIT License | 5 votes |
constructor(private navbarHandler: NavbarHandlerService, public validationService: ValidationService, public functions: AngularFireFunctions, public errorHandlerService: ErrorHandlerService, private fireStorage: AngularFireStorage, private location: Location, private authService: AuthService, public router: Router,public uploadService: FileUploadService,public backendService: BackendService) { }
Example #20
Source File: hero-detail.component.ts From angular-dream-stack with MIT License | 5 votes |
constructor(
private route: ActivatedRoute,
private heroService: HeroService,
private location: Location
) {}
Example #21
Source File: edittask.component.ts From muino-time-management with GNU General Public License v3.0 | 5 votes |
constructor(private data: ProjectService, private route: ActivatedRoute, private router: Router, private location: Location) { }
Example #22
Source File: warning.component.ts From worktez with MIT License | 5 votes |
constructor(private router: Router, private functions: AngularFireFunctions, public authService: AuthService, private location: Location, public toolsService: ToolsService, public errorHandlerService: ErrorHandlerService, private backendService: BackendService) { }
Example #23
Source File: custom-camera.page.ts From capture-lite with GNU General Public License v3.0 | 5 votes |
constructor(
private readonly location: Location,
private readonly router: Router,
private readonly customCameraService: CustomCameraService,
private readonly goProBluetoothService: GoProBluetoothService,
private readonly errorService: ErrorService,
private readonly userGuideService: UserGuideService
) {}
Example #24
Source File: app.component.ts From App with MIT License | 5 votes |
constructor(
@Inject(PLATFORM_ID) platformId: any,
iconRegistry: MatIconRegistry,
sanitizer: DomSanitizer,
appService: AppService,
titleService: Title,
localStorageSvc: LocalStorageService,
private windowRef: WindowRef,
private sw: SwUpdate,
private dialog: MatDialog,
private location: Location,
private router: Router,
private overlayRef: OverlayContainer,
public viewportService: ViewportService
) {
// Check if platform is browser
AppComponent.isBrowser.next(isPlatformBrowser(platformId));
for (const iconRef of iconList) {
iconRegistry.addSvgIcon(
iconRef[0],
sanitizer.bypassSecurityTrustResourceUrl(`assets/${iconRef[1]}`)
);
}
// Set page title
{
router.events.pipe( // Handle "ActivationStart" router event
filter(ev => ev instanceof ActivationStart),
map(ev => ev as ActivationStart),
// Find variables and omit them from the title.
// Components can call AppService.pushTitleAttributes() to update them
tap(ev => {
const title: string = '7TV - ' + (ev.snapshot.data?.title ?? 'Untitled Page' as string);
appService.pageTitleSnapshot = String(title);
titleService.setTitle(`${title?.replace(AppService.PAGE_ATTR_REGEX, '')}`);
})
).subscribe();
}
this.setTheme();
if (isPlatformBrowser(platformId)) {
localStorageSvc.storage = localStorage;
}
}
Example #25
Source File: header.component.ts From mylog14 with GNU General Public License v3.0 | 5 votes |
constructor(
private readonly location: Location,
) { }
Example #26
Source File: external-auth.service.ts From ng-conf-2020-workshop with MIT License | 5 votes |
constructor(
private router: Router,
private oidcSecurityService: OidcSecurityService,
private oidcConfigService: OidcConfigService,
private location: Location,
private localStorage: LocalStorageService) {
}
Example #27
Source File: recipe.component.ts From nuxx with GNU Affero General Public License v3.0 | 5 votes |
constructor(public restService: RestService, public dialog: MatDialog, private store: Store<AppState>, private _location: Location, private authenticationService: AuthenticationService, private router: Router) { }
Example #28
Source File: analytics.service.ts From digital-bank-ui with Mozilla Public License 2.0 | 5 votes |
constructor(private location: Location, private router: Router) {
this.enabled = false;
}
Example #29
Source File: dashboard.service.ts From sba-angular with MIT License | 5 votes |
constructor(
public modalService: ModalService,
public userSettingsService: UserSettingsWebService,
public loginService: LoginService,
public prefs: UserPreferences,
public searchService: SearchService,
public notificationService: NotificationsService,
public router: Router,
public location: Location,
public urlSerializer: UrlSerializer,
public clipboard: Clipboard,
public intlService: IntlService
) {
// Default options of the Gridster dashboard
this.options = {
swap: true,
draggable: {
enabled: true,
ignoreContent: true, // By default, dragging is impossible
dragHandleClass: 'card-header', // except in the facet header
ignoreContentClass: 'btn-group', // *except* in the button group
},
resizable: {enabled: true},
itemChangeCallback: (item, itemComponent) => {
this.notifyItemChange(item as DashboardItem);
},
itemResizeCallback: (item, itemComponent) => {
if (!document.fullscreenElement) { // Exclude the change detection on switch from/to full-screen mode
/** Items must know their height/width to (re)size their content*/
if (!itemComponent.el.classList.contains('widget-maximized-view')) {
item.height = itemComponent.height;
item.width = itemComponent.width;
} else {
item.height = itemComponent.gridster.curHeight;
item.width = itemComponent.gridster.curWidth;
}
this.notifyItemChange(item as DashboardItem);
}
},
scrollToNewItems: true, // Scroll to new items when inserted
gridType: 'verticalFixed', // The grid has a fixed size vertically, and fits the screen horizontally
fixedRowHeight: (window.innerHeight - 150) / 4, // 150px to account for header and margins
minRows: 4,
minCols: 4
};
// Manage URL changes (which may include dashboard name or config to be imported)
this.router.events.subscribe(event => {
if(event instanceof NavigationEnd) {
this.handleNavigation();
}
})
// Dashboards are stored in User Settings
this.userSettingsService.events.subscribe(event => {
// E.g. new login occurs
// ==> Menus need to be rebuilt
if(this.openAction) {
this.updateOpenAction();
this.updateAutoSaveAction();
this.setLayout(this.layout);
}
});
// Manage Autosave
this.dashboardChanged.subscribe(dashboard => {
if(this.autoSave && this.isDashboardSaved()) {
this.debounceSave();
}
});
}