fix: change v2's link to v2.angular.cn
This commit is contained in:
parent
2a0c436347
commit
8f950c26f2
|
@ -441,7 +441,7 @@
|
||||||
],
|
],
|
||||||
|
|
||||||
"docVersions": [
|
"docVersions": [
|
||||||
{ "title": "v2", "url": "https://v2.angular.io" },
|
{ "title": "v2", "url": "https://v2.angular.cn" },
|
||||||
{ "title": "AngularDart", "url": "https://webdev.dartlang.org/angular" }
|
{ "title": "AngularDart", "url": "https://webdev.dartlang.org/angular" }
|
||||||
|
|
||||||
]
|
]
|
||||||
|
|
|
@ -911,7 +911,7 @@ class TestHttp {
|
||||||
static versionFull = '4.0.0-local+sha.73808dd';
|
static versionFull = '4.0.0-local+sha.73808dd';
|
||||||
|
|
||||||
static docVersions: NavigationNode[] = [
|
static docVersions: NavigationNode[] = [
|
||||||
{ title: 'v2', url: 'https://v2.angular.io' }
|
{ title: 'v2', url: 'https://v2.angular.cn' }
|
||||||
];
|
];
|
||||||
|
|
||||||
// tslint:disable:quotemark
|
// tslint:disable:quotemark
|
||||||
|
|
|
@ -1,18 +1,18 @@
|
||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
import { Http, Response } from '@angular/http';
|
import { Http, Response } from '@angular/http';
|
||||||
|
import { LocationService } from 'app/shared/location.service';
|
||||||
import { Observable } from 'rxjs/Observable';
|
import { Logger } from 'app/shared/logger.service';
|
||||||
import { AsyncSubject } from 'rxjs/AsyncSubject';
|
|
||||||
import { of } from 'rxjs/observable/of';
|
|
||||||
import 'rxjs/add/operator/catch';
|
import 'rxjs/add/operator/catch';
|
||||||
import 'rxjs/add/operator/map';
|
import 'rxjs/add/operator/map';
|
||||||
import 'rxjs/add/operator/switchMap';
|
import 'rxjs/add/operator/switchMap';
|
||||||
|
import { AsyncSubject } from 'rxjs/AsyncSubject';
|
||||||
|
|
||||||
|
import { Observable } from 'rxjs/Observable';
|
||||||
|
import { of } from 'rxjs/observable/of';
|
||||||
|
|
||||||
import { DocumentContents } from './document-contents';
|
import { DocumentContents } from './document-contents';
|
||||||
export { DocumentContents } from './document-contents';
|
|
||||||
|
|
||||||
import { LocationService } from 'app/shared/location.service';
|
export { DocumentContents } from './document-contents';
|
||||||
import { Logger } from 'app/shared/logger.service';
|
|
||||||
|
|
||||||
export const FILE_NOT_FOUND_ID = 'file-not-found';
|
export const FILE_NOT_FOUND_ID = 'file-not-found';
|
||||||
export const FETCHING_ERROR_ID = 'fetching-error';
|
export const FETCHING_ERROR_ID = 'fetching-error';
|
||||||
|
@ -23,10 +23,9 @@ const FETCHING_ERROR_CONTENTS = `
|
||||||
<div class="nf-container l-flex-wrap flex-center">
|
<div class="nf-container l-flex-wrap flex-center">
|
||||||
<div class="nf-icon material-icons">error_outline</div>
|
<div class="nf-icon material-icons">error_outline</div>
|
||||||
<div class="nf-response l-flex-wrap">
|
<div class="nf-response l-flex-wrap">
|
||||||
<h1 class="no-toc">Request for document failed.</h1>
|
<h1 class="no-toc">请求文档失败</h1>
|
||||||
<p>
|
<p>
|
||||||
We are unable to retrieve the "<current-location></current-location>" page at this time.
|
抱歉,这次我们没能取到 "<current-location></current-location>" 页。请检查你的网络连接,稍后再试。
|
||||||
Please check your connection and try again later.
|
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -39,8 +38,7 @@ export class DocumentService {
|
||||||
|
|
||||||
currentDocument: Observable<DocumentContents>;
|
currentDocument: Observable<DocumentContents>;
|
||||||
|
|
||||||
constructor(
|
constructor(private logger: Logger,
|
||||||
private logger: Logger,
|
|
||||||
private http: Http,
|
private http: Http,
|
||||||
location: LocationService) {
|
location: LocationService) {
|
||||||
// Whenever the URL changes we try to get the appropriate doc
|
// Whenever the URL changes we try to get the appropriate doc
|
||||||
|
@ -50,7 +48,7 @@ export class DocumentService {
|
||||||
private getDocument(url: string) {
|
private getDocument(url: string) {
|
||||||
const id = url || 'index';
|
const id = url || 'index';
|
||||||
this.logger.log('getting document', id);
|
this.logger.log('getting document', id);
|
||||||
if ( !this.cache.has(id)) {
|
if (!this.cache.has(id)) {
|
||||||
this.cache.set(id, this.fetchDocument(id));
|
this.cache.set(id, this.fetchDocument(id));
|
||||||
}
|
}
|
||||||
return this.cache.get(id);
|
return this.cache.get(id);
|
||||||
|
@ -78,7 +76,7 @@ export class DocumentService {
|
||||||
} else {
|
} else {
|
||||||
return of({
|
return of({
|
||||||
id: FILE_NOT_FOUND_ID,
|
id: FILE_NOT_FOUND_ID,
|
||||||
contents: 'Document not found'
|
contents: '文档未找到',
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -88,7 +86,7 @@ export class DocumentService {
|
||||||
this.cache.delete(id);
|
this.cache.delete(id);
|
||||||
return Observable.of({
|
return Observable.of({
|
||||||
id: FETCHING_ERROR_ID,
|
id: FETCHING_ERROR_ID,
|
||||||
contents: FETCHING_ERROR_CONTENTS
|
contents: FETCHING_ERROR_CONTENTS,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -250,7 +250,7 @@ describe('NavigationService', () => {
|
||||||
actualDocVersions = [];
|
actualDocVersions = [];
|
||||||
docVersions = [
|
docVersions = [
|
||||||
{ title: 'v4.0.0' },
|
{ title: 'v4.0.0' },
|
||||||
{ title: 'v2', url: 'https://v2.angular.io' }
|
{ title: 'v2', url: 'https://v2.angular.cn' }
|
||||||
];
|
];
|
||||||
|
|
||||||
expectedDocVersions = docVersions.map(v => (
|
expectedDocVersions = docVersions.map(v => (
|
||||||
|
|
Loading…
Reference in New Issue