本文整理汇总了TypeScript中@angular/common.Location.prepareExternalUrl方法的典型用法代码示例。如果您正苦于以下问题:TypeScript Location.prepareExternalUrl方法的具体用法?TypeScript Location.prepareExternalUrl怎么用?TypeScript Location.prepareExternalUrl使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类@angular/common.Location
的用法示例。
在下文中一共展示了Location.prepareExternalUrl方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: String
(prev, route: AngularRoute & {server?: boolean}) => {
const prepared = location.prepareExternalUrl(parent.concat(route.path || []).join('/'));
const path = prepared.replace(/(^\.|\*\*?)/g, String()).split(/\//g).filter(v => v);
return prev.concat({path, server: route.server}, flatten(path, route.children || []));
},
示例2: getDetails
getDetails(cid, ckid, member_id): Observable<any> {
const fhid = this.authService.getFirehallId();
const href = this.location.prepareExternalUrl('../angular-services/callout-details-service.php');
const requestUrl = `${href}/details?fhid=${fhid}&cid=${cid}&ckid=${ckid}&member_id=${member_id}`;
// console.log('About to call details for: ' + requestUrl);
return this.http.get<CalloutDetailsItem>(requestUrl);
}
示例3: isMaps
public isMaps(path){
var titlee = this.location.prepareExternalUrl(this.location.path());
titlee = titlee.slice( 1 );
if(path === titlee){
return true;
}
else {
return false;
}
}
示例4: updateResponse
updateResponse(cid, ckid, member_id, responder_id, status_id) {
// debugger;
const fhid = this.authService.getFirehallId();
const href = this.location.prepareExternalUrl('../cr');
let requestUrl = `${href}/fhid=${fhid}&cid=${cid}&ckid=${ckid}&uid=${responder_id}&status=${status_id}`;
if (member_id !== null) {
requestUrl += `&member_id=${member_id}`;
}
return this.http.get(requestUrl, { responseType: 'text' });
}
示例5: getItemUrl
getItemUrl(item: MenuItem): string {
if(item.url) {
if(Array.isArray(item.url))
return this.location.prepareExternalUrl(this.router.generate(item.url).toLinkUrl());
else
return item.url;
}
else {
return '#';
}
}
示例6: getTitle
getTitle(){
var titlee = this.location.prepareExternalUrl(this.location.path());
if(titlee.charAt(0) === '#'){
titlee = titlee.slice( 2 );
}
for(var item = 0; item < this.listTitles.length; item++){
if(this.listTitles[item].path === titlee){
return this.listTitles[item].title;
}
}
return 'Cluster';
}
示例7: editUserAccount
editUserAccount(password1: string, password2: string, user: UserAccount): Promise<any> {
const fhid = this.authService.getFirehallId();
const href = this.location.prepareExternalUrl('../angular-services/user-accounts-service.php');
const requestUrl = `${href}/edit_user?password1=${password1}&password2=${password2}`;
return this.http.post(requestUrl, user).toPromise()
.then(response => {
//debugger;
return response;
})
.catch((err) => {
//debugger;
return this.handleErrorPromise(err);
});
}
示例8: getTitle
getTitle(){
var titlee = this.location.prepareExternalUrl(this.location.path());
if(titlee.charAt(0) === '#'){
titlee = titlee.slice( 2 );
}
titlee = titlee.split('/').pop();
for(var item = 0; item < this.listTitles.length; item++){
if(this.listTitles[item].path === titlee){
return this.listTitles[item].title;
}
}
return 'Dashboard';
}
示例9: deleteUserAccount
deleteUserAccount(user_id: number): Promise<any> {
// debugger;
const fhid = this.authService.getFirehallId();
const href = this.location.prepareExternalUrl('../angular-services/user-accounts-service.php');
const requestUrl = `${href}/delete_user?fhid=${fhid}&user_id=${user_id}`;
return this.http.post(requestUrl, null).toPromise()
.then(response => {
// debugger;
return response;
})
.catch((err) => {
debugger;
return this.handleErrorPromise(err);
});
}
示例10: send
send(msgContext: MessageContext): Promise<any> {
debugger;
const fhid = this.authService.getFirehallId();
const href = this.location.prepareExternalUrl('../angular-services/send-message-service.php');
const requestUrl = `${href}/send?fhid=${fhid}`;
return this.http.post(requestUrl, msgContext).toPromise()
.then(response => {
debugger;
return response;
})
.catch((err) => {
debugger;
return this.handleErrorPromise(err);
});
}
示例11: setLocale
setLocale(code: string) {
let url = this.ngLocation.prepareExternalUrl('/');
// The last part of the base path will be the locale
// Replace it with the selected locale
url = url.replace(/\/[a-z]{2}-[A-Z]{2}\/$/, `/${code}`);
// Finally tack the path of the current page back onto the URL
// which is more friendly than forcing them back to the splash page.
url += this.ngLocation.path();
// Set a 10-year locale cookie to maintain compatibility
// with the AngularJS client.
// Cookie takes the form aa_bb instead of aa-BB
const cookie = code.replace(/-/, '_').toLowerCase();
this.cookieService.put('eg_locale',
cookie, {path : '/', secure: true, expires: '+10y'});
window.location.href = url;
}
示例12: prepareExternalUrl
prepareExternalUrl(url: string): string {
return this.location.prepareExternalUrl(url);
}
示例13: currentLocaleCode
// Extract the local from the URL.
// It's the last component of the base path.
// Note we don't extract it from the cookie since using cookies
// to store the locale will not be necessary when AngularJS
// is deprecated.
currentLocaleCode(): string {
const base = this.ngLocation.prepareExternalUrl('/');
const code = base.match(/\/([a-z]{2}-[A-Z]{2})\/$/);
return code ? code[1] : '';
}
示例14: _updateLink
// because auxiliary links take existing primary and auxiliary routes into account,
// we need to update the link whenever params or other routes change.
private _updateLink(): void {
this._navigationInstruction = this._router.generate(this._routeParams);
var navigationHref = this._navigationInstruction.toLinkUrl();
this.visibleHref = this._location.prepareExternalUrl(navigationHref);
}
示例15:
router.subscribe((value: any) => {
console.log('this is working');
if (!this.settings.developerMode) {
var url = location.path();
if (this.settings.pageTracking.autoTrackVirtualPages && !this.matchesExcludedRouteChild(url)) {
this.pageTrack.next({
path: this.settings.pageTracking.basePath.length ? this.settings.pageTracking.basePath + url : location.prepareExternalUrl(url),
location: location
});
}
}
})