本文整理匯總了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
});
}
}
})