+
diff --git a/public/docs/_examples/security/ts/app/bypass-security.component.ts b/public/docs/_examples/security/ts/app/bypass-security.component.ts
index 6a5f350d28..a18d4251a5 100644
--- a/public/docs/_examples/security/ts/app/bypass-security.component.ts
+++ b/public/docs/_examples/security/ts/app/bypass-security.component.ts
@@ -8,14 +8,18 @@ import { DomSanitizationService, SafeResourceUrl, SafeUrl } from '@angular/platf
templateUrl: 'app/bypass-security.component.html',
})
export class BypassSecurityComponent {
- dangerousUrl: SafeUrl;
+ dangerousUrl: string;
+ trustedUrl: SafeUrl;
+ dangerousVideoUrl: string;
videoUrl: SafeResourceUrl;
// #docregion trust-url
constructor(private sanitizer: DomSanitizationService) {
- // javascript: URLs are dangerous if attacker controlled. Angular sanitizes them in data
- // binding, but we can explicitly tell Angular to trust this value:
- this.dangerousUrl = sanitizer.bypassSecurityTrustUrl('javascript:alert("Hi there")');
+ // javascript: URLs are dangerous if attacker controlled.
+ // Angular sanitizes them in data binding, but we can
+ // explicitly tell Angular to trust this value:
+ this.dangerousUrl = 'javascript:alert("Hi there")';
+ this.trustedUrl = sanitizer.bypassSecurityTrustUrl(this.dangerousUrl);
// #enddocregion trust-url
this.updateVideoUrl('PUBnlbjZFAI');
}
@@ -23,11 +27,12 @@ export class BypassSecurityComponent {
// #docregion trust-video-url
updateVideoUrl(id: string) {
// Appending an ID to a YouTube URL is safe.
- // Always make sure to construct SafeValue objects as close as possible to the input data, so
+ // Always make sure to construct SafeValue objects as
+ // close as possible to the input data, so
// that it's easier to check if the value is safe.
+ this.dangerousVideoUrl = 'https://www.youtube.com/embed/' + id;
this.videoUrl =
- this.sanitizer.bypassSecurityTrustResourceUrl('https://www.youtube.com/embed/' + id);
+ this.sanitizer.bypassSecurityTrustResourceUrl(this.dangerousVideoUrl);
}
// #enddocregion trust-video-url
}
-// #enddocregion
diff --git a/public/docs/_examples/security/ts/app/inner-html-binding.component.ts b/public/docs/_examples/security/ts/app/inner-html-binding.component.ts
index 95a9f55979..0419e5b324 100644
--- a/public/docs/_examples/security/ts/app/inner-html-binding.component.ts
+++ b/public/docs/_examples/security/ts/app/inner-html-binding.component.ts
@@ -11,4 +11,3 @@ export class InnerHtmlBindingComponent {
// E.g. a user/attacker controlled value from a URL.
htmlSnippet = 'Template Syntax';
}
-// #enddocregion inner-html-controller
diff --git a/public/docs/_examples/security/ts/index.html b/public/docs/_examples/security/ts/index.html
index b665a8bc6f..16eeeb2b2a 100644
--- a/public/docs/_examples/security/ts/index.html
+++ b/public/docs/_examples/security/ts/index.html
@@ -1,5 +1,5 @@
-
+
Angular Content Security
@@ -21,6 +21,6 @@
- Loading...
+ Loading...
diff --git a/public/docs/_examples/systemjs.config.plunker.js b/public/docs/_examples/systemjs.config.plunker.js
index a9ec367c33..fbf84a69ba 100644
--- a/public/docs/_examples/systemjs.config.plunker.js
+++ b/public/docs/_examples/systemjs.config.plunker.js
@@ -5,9 +5,9 @@
*/
(function(global) {
- var ngVer = '@2.0.0-rc.3'; // lock in the angular package version; do not let it float to current!
- var routerVer = '@3.0.0-alpha.7'; // lock router version
- var formsVer = '@0.1.1'; // lock forms version
+ var ngVer = '@2.0.0-rc.4'; // lock in the angular package version; do not let it float to current!
+ var routerVer = '@3.0.0-beta.1'; // lock router version
+ var formsVer = '@0.2.0'; // lock forms version
var routerDeprecatedVer = '@2.0.0-rc.2'; // temporarily until we update all the guides
//map tells the System loader where to look for things
diff --git a/public/docs/_examples/template-syntax/ts/app/app.component.html b/public/docs/_examples/template-syntax/ts/app/app.component.html
index fbe3527362..ebd9981e1a 100644
--- a/public/docs/_examples/template-syntax/ts/app/app.component.html
+++ b/public/docs/_examples/template-syntax/ts/app/app.component.html
@@ -589,18 +589,9 @@ bindon-ngModel
({{hero.id}}) {{hero.fullName}}
-
with *ngForTrackBy
-
-
-
({{hero.id}}) {{hero.fullName}}
-
-
-
with generic trackById function
-
-
({{hero.id}}) {{hero.fullName}}
-
+
({{hero.id}}) {{hero.fullName}}
top
diff --git a/public/docs/_examples/toh-5/ts/app/app.routes.2.ts b/public/docs/_examples/toh-5/ts/app/app.routes.2.ts
index 45ddeb9230..47311fcd8d 100644
--- a/public/docs/_examples/toh-5/ts/app/app.routes.2.ts
+++ b/public/docs/_examples/toh-5/ts/app/app.routes.2.ts
@@ -4,7 +4,7 @@ import { HeroesComponent } from './heroes.component';
const routes: RouterConfig = [
{
- path: '/heroes',
+ path: 'heroes',
component: HeroesComponent
}
];
diff --git a/public/docs/_examples/upgrade-phonecat-3-final/ts/app/phone-list/phone-list.component.spec.ts b/public/docs/_examples/upgrade-phonecat-3-final/ts/app/phone-list/phone-list.component.spec.ts
index 3e0f5f1943..3d6cd93b15 100644
--- a/public/docs/_examples/upgrade-phonecat-3-final/ts/app/phone-list/phone-list.component.spec.ts
+++ b/public/docs/_examples/upgrade-phonecat-3-final/ts/app/phone-list/phone-list.component.spec.ts
@@ -1,25 +1,28 @@
+/* tslint:disable */
// #docregion routestuff
-import { ApplicationRef } from '@angular/core';
-import { LocationStrategy } from '@angular/common';
+import { Directive } from '@angular/core';
import { HTTP_PROVIDERS } from '@angular/http';
import {
- ROUTER_PROVIDERS,
+ Router,
+ RouterLink,
+ RootRouter,
+ RouteRegistry,
ROUTER_PRIMARY_COMPONENT
} from '@angular/router-deprecated';
import { Observable } from 'rxjs/Rx';
import {
describe,
- beforeEachProviders,
+ addProviders,
inject,
it,
expect,
- MockApplicationRef
+ // MockApplicationRef
} from '@angular/core/testing';
-import { MockLocationStrategy } from '@angular/common/testing';
+import { SpyLocation } from '@angular/common/testing';
import {
TestComponentBuilder,
ComponentFixture
-} from '@angular/compiler/testing';
+} from '@angular/core/testing';
import { AppComponent } from '../app.component';
import { PhoneListComponent } from './phone-list.component';
@@ -27,6 +30,11 @@ import { Phone, PhoneData } from '../core/phone/phone.service';
// #enddocregion routestuff
+@Directive({
+ selector: '[routerLink]',
+ inputs: ['routeParams: routerLink', 'target: target']
+})
+class RouterLinkMock {}
class MockPhone extends Phone {
query(): Observable {
@@ -41,19 +49,22 @@ describe('PhoneList', () => {
// #docregion routestuff
- beforeEachProviders(() => [
- { provide: Phone, useClass: MockPhone},
- HTTP_PROVIDERS,
- ROUTER_PROVIDERS,
- { provide: ApplicationRef, useClass: MockApplicationRef },
+ addProviders([
+ RouteRegistry,
+ { provide: Router, useClass: RootRouter },
{ provide: ROUTER_PRIMARY_COMPONENT, useValue: AppComponent },
- { provide: LocationStrategy, useClass: MockLocationStrategy},
+ { provide: Location, useClass: SpyLocation},
+ { provide: Phone, useClass: MockPhone},
+ HTTP_PROVIDERS
]);
// #enddocregion routestuff
it('should create "phones" model with 2 phones fetched from xhr',
inject([TestComponentBuilder], (tcb: TestComponentBuilder) => {
- return tcb.createAsync(PhoneListComponent)
+ return tcb
+ .overrideDirective(AppComponent, RouterLink, RouterLinkMock)
+ .overrideDirective(PhoneListComponent, RouterLink, RouterLinkMock)
+ .createAsync(PhoneListComponent)
.then((fixture: ComponentFixture) => {
fixture.detectChanges();
let compiled = fixture.debugElement.nativeElement;
@@ -69,7 +80,10 @@ describe('PhoneList', () => {
it('should set the default value of orderProp model',
inject([TestComponentBuilder], (tcb: TestComponentBuilder) => {
- return tcb.createAsync(PhoneListComponent)
+ return tcb
+ .overrideDirective(AppComponent, RouterLink, RouterLinkMock)
+ .overrideDirective(PhoneListComponent, RouterLink, RouterLinkMock)
+ .createAsync(PhoneListComponent)
.then((fixture: ComponentFixture) => {
fixture.detectChanges();
let compiled = fixture.debugElement.nativeElement;
diff --git a/public/docs/_examples/webpack/ts/package.webpack.json b/public/docs/_examples/webpack/ts/package.webpack.json
index cc5948be7f..8d7fa67496 100644
--- a/public/docs/_examples/webpack/ts/package.webpack.json
+++ b/public/docs/_examples/webpack/ts/package.webpack.json
@@ -10,14 +10,14 @@
},
"license": "MIT",
"dependencies": {
- "@angular/common": "2.0.0-rc.3",
- "@angular/compiler": "2.0.0-rc.3",
- "@angular/core": "2.0.0-rc.3",
- "@angular/forms": "0.1.1",
- "@angular/http": "2.0.0-rc.3",
- "@angular/platform-browser": "2.0.0-rc.3",
- "@angular/platform-browser-dynamic": "2.0.0-rc.3",
- "@angular/router": "3.0.0-alpha.8",
+ "@angular/common": "2.0.0-rc.4",
+ "@angular/compiler": "2.0.0-rc.4",
+ "@angular/core": "2.0.0-rc.4",
+ "@angular/forms": "0.2.0",
+ "@angular/http": "2.0.0-rc.4",
+ "@angular/platform-browser": "2.0.0-rc.4",
+ "@angular/platform-browser-dynamic": "2.0.0-rc.4",
+ "@angular/router": "3.0.0-beta.1",
"core-js": "^2.4.0",
"reflect-metadata": "0.1.2",
"rxjs": "5.0.0-beta.6",
diff --git a/public/docs/js/latest/_data.json b/public/docs/js/latest/_data.json
index 5227a9dd16..7d5ed7b13a 100644
--- a/public/docs/js/latest/_data.json
+++ b/public/docs/js/latest/_data.json
@@ -3,7 +3,7 @@
"icon": "home",
"title": "Angular Docs",
"menuTitle": "Docs Home",
- "banner": "Welcome to Angular in JavaScript! The current Angular 2 release is rc.3. Please consult the Change Log about recent enhancements, fixes, and breaking changes."
+ "banner": "Welcome to Angular in JavaScript! The current Angular 2 release is rc.4. Please consult the Change Log about recent enhancements, fixes, and breaking changes."
},
"quickstart": {
diff --git a/public/docs/ts/latest/_data.json b/public/docs/ts/latest/_data.json
index 891bbfaad6..700393423a 100644
--- a/public/docs/ts/latest/_data.json
+++ b/public/docs/ts/latest/_data.json
@@ -3,7 +3,7 @@
"icon": "home",
"title": "Angular文档",
"menuTitle": "文档首页",
- "banner": "欢迎来到 Angular in TypeScript! 当前的Angular版本是 rc.3。请参考变更记录、最新功能、BUG修复和重大的破坏性更改。"
+ "banner": "欢迎来到 Angular in TypeScript! 当前的Angular版本是 rc.4。请参考变更记录、最新功能、BUG修复和重大的破坏性更改。"
},
"cli-quickstart": {
diff --git a/public/docs/ts/latest/guide/router.jade b/public/docs/ts/latest/guide/router.jade
index 0a9fb705f2..dc1682c9c7 100644
--- a/public/docs/ts/latest/guide/router.jade
+++ b/public/docs/ts/latest/guide/router.jade
@@ -3,7 +3,7 @@ include ../_util-fns
.alert.is-important
:marked
- The Component Router is in alpha release. This is the recommended Angular 2 router and supersedes
+ The Component Router is in beta release. This is the recommended Angular 2 router and supersedes
the earlier *deprecated beta* and *v2* routers.
组件路由器已经进入了Alpha阶段,推荐在Angular 2中使用此路由器,以取代早前*废弃的beta版*及*第二版*路由器。
@@ -1612,7 +1612,7 @@ h3#nav-to-list 导航回列表组件
除非我们能学到点新东西,否则这种练习就没啥亮点。
不过,我们已经有了一些新主意和新技巧:
- * We'd like our route URLs to branch in to child route trees that reflect the component treese in our feature areas.
+ * We'd like our route URLs to branch in to child route trees that reflect the component trees in our feature areas.
* 我们希望把这些路由地址组织成一棵子路由树,它应该能反映本特性区中组件树的结构。
@@ -1909,8 +1909,8 @@ code-example(format="").
:marked
Since we only want to redirect when our path specifically matches `''`, we've added an extra configuration
- to our route using `terminal: true`. Mainly for redirects, the `terminal` property gives us more control over
- when the router should continue matching our URL against our defined routes.
+ to our route using `terminal: true`. Mainly for redirects, the `terminal` property tells the router
+ whether or not it should continue matching our URL against the rest of our defined routes.
由于我们希望只有在路径明确的匹配到`''`时才重定向,所以我们往路由中添加了一个额外的配置项:`terminal: true`。
主要是为了重定向,`terminal`属性是用来控制路由器是否应该继续匹配URL和我们定义的路由。(译者注:`terminal`设置为`true`时,该路由的优先级别就低于其他路由,只有在所有其他路由都不匹配的时候才最后匹配这个路由。主要是为了标示专用于重定向的路由而设计的。)
diff --git a/public/docs/ts/latest/guide/security.jade b/public/docs/ts/latest/guide/security.jade
index 98958083e0..3eb7506f4f 100644
--- a/public/docs/ts/latest/guide/security.jade
+++ b/public/docs/ts/latest/guide/security.jade
@@ -1,7 +1,7 @@
block includes
include ../_util-fns
:marked
- Web application security has many aspects. This documentation describes Angular's built in
+ Web application security has many aspects. This chapter describes Angular's built in
protections against common web application vulnerabilities and attacks, such as Cross Site
Scripting Attacks. It does not cover application level security, such as authentication (_Who is
this user?_) or authorization (_What can this user do?_).
@@ -97,7 +97,7 @@ h2#xss 防范跨站脚本(XSS)攻击
:marked
[Cross-Site Scripting (XSS)](https://en.wikipedia.org/wiki/Cross-site_scripting) enables attackers
- to inject malicious code into web pages. Such code can then for example steal user's data (in
+ to inject malicious code into web pages. Such code can then, for example, steal user's data (in
particular their login data), or perform actions impersonating the user. This is one of the most
common attacks on the web.
@@ -151,7 +151,7 @@ h2#xss 防范跨站脚本(XSS)攻击
Angular定义了四个安全环境:HTML,样式,URL,和资源URL。
- * HTML is used when interpreting a value as HTML, e.g. when binding to `innerHtml`
+ * HTML is used when interpreting a value as HTML, e.g., when binding to `innerHtml`
* HTML:值需要被解释为HTML时使用,比如当绑定到`innerHTML`时。
@@ -163,7 +163,7 @@ h2#xss 防范跨站脚本(XSS)攻击
* URL:值需要被用作URL属性时使用,比如``。
- * Resource URLs are URLs that will be loaded and executed as code, e.g. in `