X Tutup
Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
724 changes: 379 additions & 345 deletions gulpfile.js

Large diffs are not rendered by default.

29 changes: 15 additions & 14 deletions modules/angular1_router/src/ng_outlet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ function ngOutletDirective($animate, $q: ng.IQService, $rootRouter) {
result = this.currentController.$routerCanReuse(nextInstruction, this.currentInstruction);
} else {
result = nextInstruction === this.currentInstruction ||
angular.equals(nextInstruction.params, this.currentInstruction.params);
angular.equals(nextInstruction.params, this.currentInstruction.params);
}
return $q.when(result);
}
Expand Down Expand Up @@ -110,7 +110,7 @@ function ngOutletDirective($animate, $q: ng.IQService, $rootRouter) {
}

this.controller.$$template = '<' + dashCase(componentName) + ' $router="::$$router"></' +
dashCase(componentName) + '>';
dashCase(componentName) + '>';
this.controller.$$router = this.router.childRouter(instruction.componentType);
this.controller.$$outlet = this;

Expand Down Expand Up @@ -165,8 +165,8 @@ function routerTriggerDirective($q) {
var currentComponent = outlet.currentController =
element.controller(ngOutletCtrl.$$componentName);
if (currentComponent.$routerOnActivate) {
promise = $q.when(currentComponent.$routerOnActivate(outlet.currentInstruction,
outlet.previousInstruction));
promise = $q.when(currentComponent.$routerOnActivate(
outlet.currentInstruction, outlet.previousInstruction));
}
promise.then(outlet.deferredActivation.resolve, outlet.deferredActivation.reject);
}
Expand Down Expand Up @@ -213,14 +213,15 @@ function ngLinkDirective($rootRouter, $parse) {
function getLink(params) {
navigationInstruction = router.generate(params);

scope.$watch(function() { return router.isRouteActive(navigationInstruction); },
function(active) {
if (active) {
element.addClass('ng-link-active');
} else {
element.removeClass('ng-link-active');
}
});
scope.$watch(
function() { return router.isRouteActive(navigationInstruction); },
function(active) {
if (active) {
element.addClass('ng-link-active');
} else {
element.removeClass('ng-link-active');
}
});

const navigationHref = navigationInstruction.toLinkUrl();
return $rootRouter._location.prepareExternalUrl(navigationHref);
Expand All @@ -232,8 +233,8 @@ function ngLinkDirective($rootRouter, $parse) {
let params = routeParamsGetter();
element.attr('href', getLink(params));
} else {
scope.$watch(() => routeParamsGetter(scope), params => element.attr('href', getLink(params)),
true);
scope.$watch(
() => routeParamsGetter(scope), params => element.attr('href', getLink(params)), true);
}

element.on('click', event => {
Expand Down
8 changes: 1 addition & 7 deletions modules/angular2/core.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,7 @@ export * from './src/core/di';
export * from './src/facade/facade';
export {enableProdMode} from 'angular2/src/facade/lang';
export {platform, createNgZone, PlatformRef, ApplicationRef} from './src/core/application_ref';
export {
APP_ID,
APP_COMPONENT,
APP_INITIALIZER,
PACKAGE_ROOT_URL,
PLATFORM_INITIALIZER
} from './src/core/application_tokens';
export {APP_ID, APP_COMPONENT, APP_INITIALIZER, PACKAGE_ROOT_URL, PLATFORM_INITIALIZER} from './src/core/application_tokens';
export * from './src/core/zone';
export * from './src/core/render';
export * from './src/core/linker';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ expect(door.lock instanceof Lock).toBe(true);
// #enddocregion

// #docregion resolve_forward_ref
var ref = forwardRef(() => "refValue");
expect(resolveForwardRef(ref)).toEqual("refValue");
expect(resolveForwardRef("regularValue")).toEqual("regularValue");
var ref = forwardRef(() => 'refValue');
expect(resolveForwardRef(ref)).toEqual('refValue');
expect(resolveForwardRef('regularValue')).toEqual('regularValue');
// #enddocregion
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,15 @@ export class AsyncPipeExample {
if (this.arrived) {
this.reset();
} else {
this.resolve("hi there!");
this.resolve('hi there!');
this.arrived = true;
}
}
}
// #enddocregion

// #docregion AsyncPipeObservable
@Component({selector: "task-cmp", template: "Time: {{ time | async }}"})
@Component({selector: 'task-cmp', template: 'Time: {{ time | async }}'})
class Task {
time = new Observable<number>((observer: Subscriber<number>) => {
setInterval(() => observer.next(new Date().getTime()), 500);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
import {provide, Component} from 'angular2/core';
import {bootstrap} from 'angular2/platform/browser';
import {
CanActivate,
RouteConfig,
ComponentInstruction,
APP_BASE_HREF,
ROUTER_DIRECTIVES
} from 'angular2/router';
import {CanActivate, RouteConfig, ComponentInstruction, APP_BASE_HREF, ROUTER_DIRECTIVES} from 'angular2/router';

function checkIfWeHavePermission(instruction: ComponentInstruction) {
return instruction.params['id'] == '1';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,6 @@
import {provide, Component} from 'angular2/core';
import {bootstrap} from 'angular2/platform/browser';
import {
CanDeactivate,
RouteConfig,
RouteParams,
ComponentInstruction,
ROUTER_DIRECTIVES,
APP_BASE_HREF
} from 'angular2/router';
import {CanDeactivate, RouteConfig, RouteParams, ComponentInstruction, ROUTER_DIRECTIVES, APP_BASE_HREF} from 'angular2/router';

// #docregion routerCanDeactivate
@Component({
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
import {Component, provide} from 'angular2/core';
import {bootstrap} from 'angular2/platform/browser';
import {
OnActivate,
ComponentInstruction,
RouteConfig,
ROUTER_DIRECTIVES,
APP_BASE_HREF
} from 'angular2/router';
import {OnActivate, ComponentInstruction, RouteConfig, ROUTER_DIRECTIVES, APP_BASE_HREF} from 'angular2/router';

// #docregion routerOnActivate
@Component({template: `Child`})
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
import {Component, Injectable, provide} from 'angular2/core';
import {bootstrap} from 'angular2/platform/browser';
import {
OnDeactivate,
ComponentInstruction,
RouteConfig,
ROUTER_DIRECTIVES,
APP_BASE_HREF
} from 'angular2/router';
import {OnDeactivate, ComponentInstruction, RouteConfig, ROUTER_DIRECTIVES, APP_BASE_HREF} from 'angular2/router';


@Injectable()
Expand Down Expand Up @@ -57,7 +51,6 @@ class AppCmp {

export function main() {
return bootstrap(AppCmp, [
provide(APP_BASE_HREF, {useValue: '/angular2/examples/router/ts/on_deactivate'}),
LogService
provide(APP_BASE_HREF, {useValue: '/angular2/examples/router/ts/on_deactivate'}), LogService
]);
}
15 changes: 3 additions & 12 deletions modules/angular2/examples/router/ts/reuse/reuse_example.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,6 @@
import {Component, provide} from 'angular2/core';
import {bootstrap} from 'angular2/platform/browser';
import {
CanActivate,
RouteConfig,
ComponentInstruction,
ROUTER_DIRECTIVES,
APP_BASE_HREF,
CanReuse,
RouteParams,
OnReuse
} from 'angular2/router';
import {CanActivate, RouteConfig, ComponentInstruction, ROUTER_DIRECTIVES, APP_BASE_HREF, CanReuse, RouteParams, OnReuse} from 'angular2/router';


// #docregion reuseCmp
Expand Down Expand Up @@ -53,6 +44,6 @@ class AppCmp {


export function main() {
return bootstrap(AppCmp,
[provide(APP_BASE_HREF, {useValue: '/angular2/examples/router/ts/reuse'})]);
return bootstrap(
AppCmp, [provide(APP_BASE_HREF, {useValue: '/angular2/examples/router/ts/reuse'})]);
}
25 changes: 8 additions & 17 deletions modules/angular2/examples/testing/ts/testing.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,4 @@
import {
describe,
fdescribe,
xdescribe,
it,
fit,
xit,
beforeEach,
afterEach,
beforeEachProviders,
inject
} from 'angular2/testing';
import {describe, fdescribe, xdescribe, it, fit, xit, beforeEach, afterEach, beforeEachProviders, inject} from 'angular2/testing';
import {provide} from 'angular2/core';

var db: any;
Expand All @@ -30,8 +19,9 @@ fdescribe('some component', () => {
// This test will run.
});
});
describe('another component',
() => { it('also has a test', () => { throw 'This test will not run.'; }); });
describe('another component', () => {
it('also has a test', () => { throw 'This test will not run.'; });
});
// #enddocregion

// #docregion xdescribe
Expand Down Expand Up @@ -73,9 +63,10 @@ describe('some component', () => {
// #docregion beforeEachProviders
describe('some component', () => {
beforeEachProviders(() => [provide(MyService, {useClass: MyMockService})]);
it('uses MyService', inject([MyService], (service: MyMockService) => {
// service is an instance of MyMockService.
}));
it('uses MyService', inject(
[MyService], (service: MyMockService) => {
// service is an instance of MyMockService.
}));
});
// #enddocregion

Expand Down
38 changes: 14 additions & 24 deletions modules/angular2/http.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,7 @@ import {BaseResponseOptions, ResponseOptions} from './src/http/base_response_opt
export {Request} from './src/http/static_request';
export {Response} from './src/http/static_response';

export {
RequestOptionsArgs,
ResponseOptionsArgs,
Connection,
ConnectionBackend
} from './src/http/interfaces';
export {RequestOptionsArgs, ResponseOptionsArgs, Connection, ConnectionBackend} from './src/http/interfaces';

export {BrowserXhr} from './src/http/backends/browser_xhr';
export {BaseRequestOptions, RequestOptions} from './src/http/base_request_options';
Expand Down Expand Up @@ -155,16 +150,13 @@ export {URLSearchParams} from './src/http/url_search_params';
export const HTTP_PROVIDERS: any[] = [
// TODO(pascal): use factory type annotations once supported in DI
// issue: https://github.com/angular/angular/issues/3183
provide(Http,
{
useFactory: (xhrBackend: XHRBackend, requestOptions: RequestOptions) =>
new Http(xhrBackend, requestOptions),
deps: [XHRBackend, RequestOptions]
}),
BrowserXhr,
provide(RequestOptions, {useClass: BaseRequestOptions}),
provide(ResponseOptions, {useClass: BaseResponseOptions}),
XHRBackend
provide(Http, {
useFactory: (xhrBackend: XHRBackend, requestOptions: RequestOptions) =>
new Http(xhrBackend, requestOptions),
deps: [XHRBackend, RequestOptions]
}),
BrowserXhr, provide(RequestOptions, {useClass: BaseRequestOptions}),
provide(ResponseOptions, {useClass: BaseResponseOptions}), XHRBackend
];

/**
Expand Down Expand Up @@ -284,14 +276,12 @@ export const HTTP_BINDINGS = HTTP_PROVIDERS;
export const JSONP_PROVIDERS: any[] = [
// TODO(pascal): use factory type annotations once supported in DI
// issue: https://github.com/angular/angular/issues/3183
provide(Jsonp,
{
useFactory: (jsonpBackend: JSONPBackend, requestOptions: RequestOptions) =>
new Jsonp(jsonpBackend, requestOptions),
deps: [JSONPBackend, RequestOptions]
}),
BrowserJsonp,
provide(RequestOptions, {useClass: BaseRequestOptions}),
provide(Jsonp, {
useFactory: (jsonpBackend: JSONPBackend, requestOptions: RequestOptions) =>
new Jsonp(jsonpBackend, requestOptions),
deps: [JSONPBackend, RequestOptions]
}),
BrowserJsonp, provide(RequestOptions, {useClass: BaseRequestOptions}),
provide(ResponseOptions, {useClass: BaseResponseOptions}),
provide(JSONPBackend, {useClass: JSONPBackend_})
];
Expand Down
8 changes: 1 addition & 7 deletions modules/angular2/instrumentation.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1 @@
export {
wtfCreateScope,
wtfLeave,
wtfStartTimeRange,
wtfEndTimeRange,
WtfScopeFn
} from './src/core/profile/profile';
export {wtfCreateScope, wtfLeave, wtfStartTimeRange, wtfEndTimeRange, WtfScopeFn} from './src/core/profile/profile';
21 changes: 3 additions & 18 deletions modules/angular2/platform/browser.ts
Original file line number Diff line number Diff line change
@@ -1,27 +1,12 @@
export {AngularEntrypoint} from 'angular2/src/core/angular_entrypoint';
export {
BROWSER_PROVIDERS,
CACHED_TEMPLATE_PROVIDER,
ELEMENT_PROBE_PROVIDERS,
ELEMENT_PROBE_PROVIDERS_PROD_MODE,
inspectNativeElement,
BrowserDomAdapter,
By,
Title,
DOCUMENT,
enableDebugTools,
disableDebugTools
} from 'angular2/src/platform/browser_common';
export {BROWSER_PROVIDERS, CACHED_TEMPLATE_PROVIDER, ELEMENT_PROBE_PROVIDERS, ELEMENT_PROBE_PROVIDERS_PROD_MODE, inspectNativeElement, BrowserDomAdapter, By, Title, DOCUMENT, enableDebugTools, disableDebugTools} from 'angular2/src/platform/browser_common';

import {Type, isPresent, CONST_EXPR} from 'angular2/src/facade/lang';
import {
BROWSER_PROVIDERS,
BROWSER_APP_COMMON_PROVIDERS
} from 'angular2/src/platform/browser_common';
import {BROWSER_PROVIDERS, BROWSER_APP_COMMON_PROVIDERS} from 'angular2/src/platform/browser_common';
import {COMPILER_PROVIDERS} from 'angular2/compiler';
import {ComponentRef, platform, reflector} from 'angular2/core';
import {ReflectionCapabilities} from 'angular2/src/core/reflection/reflection_capabilities';
import {XHRImpl} from "angular2/src/platform/browser/xhr_impl";
import {XHRImpl} from 'angular2/src/platform/browser/xhr_impl';
import {XHR} from 'angular2/compiler';
import {Provider} from 'angular2/src/core/di';

Expand Down
23 changes: 5 additions & 18 deletions modules/angular2/platform/browser_static.ts
Original file line number Diff line number Diff line change
@@ -1,21 +1,8 @@
export {AngularEntrypoint} from 'angular2/src/core/angular_entrypoint';
export {
BROWSER_PROVIDERS,
ELEMENT_PROBE_PROVIDERS,
ELEMENT_PROBE_PROVIDERS_PROD_MODE,
inspectNativeElement,
BrowserDomAdapter,
By,
Title,
enableDebugTools,
disableDebugTools
} from 'angular2/src/platform/browser_common';
export {BROWSER_PROVIDERS, ELEMENT_PROBE_PROVIDERS, ELEMENT_PROBE_PROVIDERS_PROD_MODE, inspectNativeElement, BrowserDomAdapter, By, Title, enableDebugTools, disableDebugTools} from 'angular2/src/platform/browser_common';

import {Type, isPresent} from 'angular2/src/facade/lang';
import {
BROWSER_PROVIDERS,
BROWSER_APP_COMMON_PROVIDERS
} from 'angular2/src/platform/browser_common';
import {BROWSER_PROVIDERS, BROWSER_APP_COMMON_PROVIDERS} from 'angular2/src/platform/browser_common';
import {ComponentRef, platform} from 'angular2/core';

/**
Expand All @@ -29,9 +16,9 @@ export const BROWSER_APP_PROVIDERS: Array<any /*Type | Provider | any[]*/> =
/**
* See {@link bootstrap} for more information.
*/
export function bootstrapStatic(appComponentType: Type,
customProviders?: Array<any /*Type | Provider | any[]*/>,
initReflector?: Function): Promise<ComponentRef> {
export function bootstrapStatic(
appComponentType: Type, customProviders?: Array<any /*Type | Provider | any[]*/>,
initReflector?: Function): Promise<ComponentRef> {
if (isPresent(initReflector)) {
initReflector();
}
Expand Down
6 changes: 1 addition & 5 deletions modules/angular2/platform/common_dom.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,6 @@ export {DomRenderer} from 'angular2/src/platform/dom/dom_renderer';
export {DOCUMENT} from 'angular2/src/platform/dom/dom_tokens';
export {SharedStylesHost, DomSharedStylesHost} from 'angular2/src/platform/dom/shared_styles_host';
export {DomEventsPlugin} from 'angular2/src/platform/dom/events/dom_events';
export {
EVENT_MANAGER_PLUGINS,
EventManager,
EventManagerPlugin
} from 'angular2/src/platform/dom/events/event_manager';
export {EVENT_MANAGER_PLUGINS, EventManager, EventManagerPlugin} from 'angular2/src/platform/dom/events/event_manager';
export * from 'angular2/src/platform/dom/debug/by';
export * from 'angular2/src/platform/dom/debug/ng_probe';
Loading
X Tutup