├── src
├── assets
│ ├── .gitkeep
│ └── card.jpg
├── favicon.ico
├── environments
│ ├── environment.prod.ts
│ └── environment.ts
├── app
│ ├── movie-item
│ │ ├── movie-item.component.css
│ │ ├── movie-item.component.ts
│ │ ├── movie-item.component.html
│ │ └── movie-item.component.spec.ts
│ ├── movie
│ │ ├── movie.component.html
│ │ ├── movie.component.css
│ │ ├── movie.component.spec.ts
│ │ └── movie.component.ts
│ ├── entity
│ │ ├── movie.ts
│ │ └── subject.ts
│ ├── api
│ │ └── api.ts
│ ├── pipe
│ │ ├── directors.pipe.spec.ts
│ │ └── directors.pipe.ts
│ ├── service
│ │ ├── event.service.spec.ts
│ │ ├── movie-net.service.spec.ts
│ │ ├── event.service.ts
│ │ └── movie-net.service.ts
│ ├── router
│ │ ├── app-routing.module.ts
│ │ └── movie.resolve.ts
│ ├── app.component.css
│ ├── app.component.spec.ts
│ ├── app.component.html
│ ├── app.component.ts
│ └── app.module.ts
├── styles.css
├── tsconfig.app.json
├── tslint.json
├── tsconfig.spec.json
├── browserslist
├── main.ts
├── index.html
├── test.ts
├── karma.conf.js
└── polyfills.ts
├── pic
├── a.png
└── b.png
├── e2e
├── tsconfig.e2e.json
├── src
│ ├── app.po.ts
│ └── app.e2e-spec.ts
└── protractor.conf.js
├── .editorconfig
├── tsconfig.json
├── .gitignore
├── LICENSE
├── package.json
├── tslint.json
├── README.md
└── angular.json
/src/assets/.gitkeep:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/pic/a.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/itning/DouBanMovieForAngular/master/pic/a.png
--------------------------------------------------------------------------------
/pic/b.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/itning/DouBanMovieForAngular/master/pic/b.png
--------------------------------------------------------------------------------
/src/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/itning/DouBanMovieForAngular/master/src/favicon.ico
--------------------------------------------------------------------------------
/src/environments/environment.prod.ts:
--------------------------------------------------------------------------------
1 | export const environment = {
2 | production: true
3 | };
4 |
--------------------------------------------------------------------------------
/src/assets/card.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/itning/DouBanMovieForAngular/master/src/assets/card.jpg
--------------------------------------------------------------------------------
/src/app/movie-item/movie-item.component.css:
--------------------------------------------------------------------------------
1 | .movie-card {
2 | margin-bottom: 10px;
3 | break-inside: avoid;
4 | background: #fff;
5 | }
6 |
--------------------------------------------------------------------------------
/src/app/movie/movie.component.html:
--------------------------------------------------------------------------------
1 |
4 |
--------------------------------------------------------------------------------
/src/app/movie/movie.component.css:
--------------------------------------------------------------------------------
1 | .movie-content {
2 | padding: 0 16px;
3 | margin: 0 auto;
4 | column-count: 5;
5 | column-width: 240px;
6 | column-gap: 20px;
7 | }
8 |
--------------------------------------------------------------------------------
/src/styles.css:
--------------------------------------------------------------------------------
1 | /* You can add global styles to this file, and also import other style files */
2 |
3 | html, body { height: 100%; }
4 | body { margin: 0; font-family: Roboto, "Helvetica Neue", sans-serif; }
5 |
--------------------------------------------------------------------------------
/src/app/entity/movie.ts:
--------------------------------------------------------------------------------
1 | import {Subject} from './subject';
2 |
3 | export class Movie {
4 | count: number;
5 | start: number;
6 | total: number;
7 | title: string;
8 | subjects: Array;
9 | }
10 |
--------------------------------------------------------------------------------
/src/tsconfig.app.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "../tsconfig.json",
3 | "compilerOptions": {
4 | "outDir": "../out-tsc/app",
5 | "types": []
6 | },
7 | "exclude": [
8 | "test.ts",
9 | "**/*.spec.ts"
10 | ]
11 | }
12 |
--------------------------------------------------------------------------------
/src/app/api/api.ts:
--------------------------------------------------------------------------------
1 | export class Api {
2 | static inTheaters = 'https://api.douban.com/v2/movie/in_theaters';
3 | static comingSoon = 'https://api.douban.com/v2/movie/coming_soon';
4 | static top250 = 'https://api.douban.com/v2/movie/top250';
5 | }
6 |
--------------------------------------------------------------------------------
/src/app/pipe/directors.pipe.spec.ts:
--------------------------------------------------------------------------------
1 | import { DirectorsPipe } from './directors.pipe';
2 |
3 | describe('DirectorsPipe', () => {
4 | it('create an instance', () => {
5 | const pipe = new DirectorsPipe();
6 | expect(pipe).toBeTruthy();
7 | });
8 | });
9 |
--------------------------------------------------------------------------------
/e2e/tsconfig.e2e.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "../tsconfig.json",
3 | "compilerOptions": {
4 | "outDir": "../out-tsc/app",
5 | "module": "commonjs",
6 | "target": "es5",
7 | "types": [
8 | "jasmine",
9 | "jasminewd2",
10 | "node"
11 | ]
12 | }
13 | }
--------------------------------------------------------------------------------
/.editorconfig:
--------------------------------------------------------------------------------
1 | # Editor configuration, see https://editorconfig.org
2 | root = true
3 |
4 | [*]
5 | charset = utf-8
6 | indent_style = space
7 | indent_size = 2
8 | insert_final_newline = true
9 | trim_trailing_whitespace = true
10 |
11 | [*.md]
12 | max_line_length = off
13 | trim_trailing_whitespace = false
14 |
--------------------------------------------------------------------------------
/e2e/src/app.po.ts:
--------------------------------------------------------------------------------
1 | import { browser, by, element } from 'protractor';
2 |
3 | export class AppPage {
4 | navigateTo() {
5 | return browser.get(browser.baseUrl) as Promise;
6 | }
7 |
8 | getTitleText() {
9 | return element(by.css('app-root h1')).getText() as Promise;
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/src/tslint.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "../tslint.json",
3 | "rules": {
4 | "directive-selector": [
5 | true,
6 | "attribute",
7 | "app",
8 | "camelCase"
9 | ],
10 | "component-selector": [
11 | true,
12 | "element",
13 | "app",
14 | "kebab-case"
15 | ]
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/src/tsconfig.spec.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "../tsconfig.json",
3 | "compilerOptions": {
4 | "outDir": "../out-tsc/spec",
5 | "types": [
6 | "jasmine",
7 | "node"
8 | ]
9 | },
10 | "files": [
11 | "test.ts",
12 | "polyfills.ts"
13 | ],
14 | "include": [
15 | "**/*.spec.ts",
16 | "**/*.d.ts"
17 | ]
18 | }
19 |
--------------------------------------------------------------------------------
/src/app/pipe/directors.pipe.ts:
--------------------------------------------------------------------------------
1 | import {Pipe, PipeTransform} from '@angular/core';
2 | import {Cast, Director} from '../entity/subject';
3 |
4 | @Pipe({
5 | name: 'filterName'
6 | })
7 | export class DirectorsPipe implements PipeTransform {
8 |
9 | transform(directors: Array | Array): string {
10 | return directors.map(d => d.name).join(',');
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/src/app/service/event.service.spec.ts:
--------------------------------------------------------------------------------
1 | import { TestBed } from '@angular/core/testing';
2 |
3 | import { EventService } from './event.service';
4 |
5 | describe('EventService', () => {
6 | beforeEach(() => TestBed.configureTestingModule({}));
7 |
8 | it('should be created', () => {
9 | const service: EventService = TestBed.get(EventService);
10 | expect(service).toBeTruthy();
11 | });
12 | });
13 |
--------------------------------------------------------------------------------
/src/app/service/movie-net.service.spec.ts:
--------------------------------------------------------------------------------
1 | import { TestBed } from '@angular/core/testing';
2 |
3 | import { MovieNetService } from './movie-net.service';
4 |
5 | describe('MovieNetService', () => {
6 | beforeEach(() => TestBed.configureTestingModule({}));
7 |
8 | it('should be created', () => {
9 | const service: MovieNetService = TestBed.get(MovieNetService);
10 | expect(service).toBeTruthy();
11 | });
12 | });
13 |
--------------------------------------------------------------------------------
/src/browserslist:
--------------------------------------------------------------------------------
1 | # This file is currently used by autoprefixer to adjust CSS to support the below specified browsers
2 | # For additional information regarding the format and rule options, please see:
3 | # https://github.com/browserslist/browserslist#queries
4 | #
5 | # For IE 9-11 support, please remove 'not' from the last line of the file and adjust as needed
6 |
7 | > 0.5%
8 | last 2 versions
9 | Firefox ESR
10 | not dead
11 | not IE 9-11
--------------------------------------------------------------------------------
/src/main.ts:
--------------------------------------------------------------------------------
1 | import 'hammerjs';
2 | import { enableProdMode } from '@angular/core';
3 | import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
4 |
5 | import { AppModule } from './app/app.module';
6 | import { environment } from './environments/environment';
7 |
8 | if (environment.production) {
9 | enableProdMode();
10 | }
11 |
12 | platformBrowserDynamic().bootstrapModule(AppModule)
13 | .catch(err => console.error(err));
14 |
--------------------------------------------------------------------------------
/src/app/movie-item/movie-item.component.ts:
--------------------------------------------------------------------------------
1 | import {Component, Input, OnInit} from '@angular/core';
2 | import {Subject} from '../entity/subject';
3 |
4 | @Component({
5 | selector: 'app-movie-item',
6 | templateUrl: './movie-item.component.html',
7 | styleUrls: ['./movie-item.component.css']
8 | })
9 | export class MovieItemComponent implements OnInit {
10 |
11 | @Input()
12 | subject: Subject;
13 |
14 | constructor() {
15 | }
16 |
17 | ngOnInit() {
18 | }
19 |
20 | }
21 |
--------------------------------------------------------------------------------
/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compileOnSave": false,
3 | "compilerOptions": {
4 | "baseUrl": "./",
5 | "outDir": "./dist/out-tsc",
6 | "sourceMap": true,
7 | "declaration": false,
8 | "module": "es2015",
9 | "moduleResolution": "node",
10 | "emitDecoratorMetadata": true,
11 | "experimentalDecorators": true,
12 | "importHelpers": true,
13 | "target": "es5",
14 | "typeRoots": [
15 | "node_modules/@types"
16 | ],
17 | "lib": [
18 | "es2018",
19 | "dom"
20 | ]
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/src/app/router/app-routing.module.ts:
--------------------------------------------------------------------------------
1 | import {RouterModule, Routes} from '@angular/router';
2 | import {NgModule} from '@angular/core';
3 | import {MovieComponent} from '../movie/movie.component';
4 | import {MovieResolve} from './movie.resolve';
5 |
6 | const routes: Routes = [
7 | {path: 'movie/:page', component: MovieComponent, resolve: {movie: MovieResolve}},
8 | {path: '**', redirectTo: 'movie/in_theaters'}
9 | ];
10 |
11 | @NgModule({
12 | imports: [RouterModule.forRoot(routes)],
13 | exports: [RouterModule],
14 | providers: [MovieResolve]
15 | })
16 | export class AppRoutingModule {
17 | }
18 |
--------------------------------------------------------------------------------
/src/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | 豆瓣电影 For Angular
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/src/app/router/movie.resolve.ts:
--------------------------------------------------------------------------------
1 | import {Movie} from '../entity/movie';
2 | import {Observable} from 'rxjs';
3 | import {Injectable} from '@angular/core';
4 | import {ActivatedRouteSnapshot, Resolve, RouterStateSnapshot} from '@angular/router';
5 | import {MovieNetService} from '../service/movie-net.service';
6 |
7 | @Injectable()
8 | export class MovieResolve implements Resolve {
9 |
10 | constructor(private movieNetService: MovieNetService) {
11 | }
12 |
13 | resolve(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable | Promise | Movie {
14 | return this.movieNetService.get(route.params.page);
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/src/app/movie-item/movie-item.component.html:
--------------------------------------------------------------------------------
1 |
2 |
3 | {{subject.title}}
4 | {{subject.original_title}}
5 |
6 |
7 |
8 | {{subject.year}} {{subject.genres}}
9 | 分数:{{subject.rating.average}}
10 | 导演:{{subject.directors | filterName}}
11 | 演员:{{subject.casts | filterName}}
12 |
13 |
14 | 查看
15 |
16 |
17 |
--------------------------------------------------------------------------------
/src/test.ts:
--------------------------------------------------------------------------------
1 | // This file is required by karma.conf.js and loads recursively all the .spec and framework files
2 |
3 | import 'zone.js/dist/zone-testing';
4 | import { getTestBed } from '@angular/core/testing';
5 | import {
6 | BrowserDynamicTestingModule,
7 | platformBrowserDynamicTesting
8 | } from '@angular/platform-browser-dynamic/testing';
9 |
10 | declare const require: any;
11 |
12 | // First, initialize the Angular testing environment.
13 | getTestBed().initTestEnvironment(
14 | BrowserDynamicTestingModule,
15 | platformBrowserDynamicTesting()
16 | );
17 | // Then we find all the tests.
18 | const context = require.context('./', true, /\.spec\.ts$/);
19 | // And load the modules.
20 | context.keys().map(context);
21 |
--------------------------------------------------------------------------------
/src/environments/environment.ts:
--------------------------------------------------------------------------------
1 | // This file can be replaced during build by using the `fileReplacements` array.
2 | // `ng build --prod` replaces `environment.ts` with `environment.prod.ts`.
3 | // The list of file replacements can be found in `angular.json`.
4 |
5 | export const environment = {
6 | production: false
7 | };
8 |
9 | /*
10 | * For easier debugging in development mode, you can import the following file
11 | * to ignore zone related error stack frames such as `zone.run`, `zoneDelegate.invokeTask`.
12 | *
13 | * This import should be commented out in production mode because it will have a negative impact
14 | * on performance if an error is thrown.
15 | */
16 | // import 'zone.js/dist/zone-error'; // Included with Angular CLI.
17 |
--------------------------------------------------------------------------------
/src/app/movie/movie.component.spec.ts:
--------------------------------------------------------------------------------
1 | import { async, ComponentFixture, TestBed } from '@angular/core/testing';
2 |
3 | import { MovieComponent } from './movie.component';
4 |
5 | describe('MovieComponent', () => {
6 | let component: MovieComponent;
7 | let fixture: ComponentFixture;
8 |
9 | beforeEach(async(() => {
10 | TestBed.configureTestingModule({
11 | declarations: [ MovieComponent ]
12 | })
13 | .compileComponents();
14 | }));
15 |
16 | beforeEach(() => {
17 | fixture = TestBed.createComponent(MovieComponent);
18 | component = fixture.componentInstance;
19 | fixture.detectChanges();
20 | });
21 |
22 | it('should create', () => {
23 | expect(component).toBeTruthy();
24 | });
25 | });
26 |
--------------------------------------------------------------------------------
/e2e/src/app.e2e-spec.ts:
--------------------------------------------------------------------------------
1 | import { AppPage } from './app.po';
2 | import { browser, logging } from 'protractor';
3 |
4 | describe('workspace-project App', () => {
5 | let page: AppPage;
6 |
7 | beforeEach(() => {
8 | page = new AppPage();
9 | });
10 |
11 | it('should display welcome message', () => {
12 | page.navigateTo();
13 | expect(page.getTitleText()).toEqual('Welcome to DouBanMovieForAngular!');
14 | });
15 |
16 | afterEach(async () => {
17 | // Assert that there are no errors emitted from the browser
18 | const logs = await browser.manage().logs().get(logging.Type.BROWSER);
19 | expect(logs).not.toContain(jasmine.objectContaining({
20 | level: logging.Level.SEVERE,
21 | } as logging.Entry));
22 | });
23 | });
24 |
--------------------------------------------------------------------------------
/src/app/app.component.css:
--------------------------------------------------------------------------------
1 | .main-container {
2 | position: absolute;
3 | top: 0;
4 | bottom: 0;
5 | left: 0;
6 | right: 0;
7 | }
8 |
9 | .toolbar-spacer {
10 | flex: 1 1 auto;
11 | }
12 |
13 | .m-l-1 {
14 | margin-left: 10px;
15 | }
16 |
17 | .card-box {
18 | left: 21px;
19 | position: absolute;
20 | top: 75px;
21 | color: #fff;
22 | }
23 |
24 | .card-title {
25 | font-size: 24px;
26 | }
27 |
28 | .card-subtitle {
29 | font-size: 14px;
30 | opacity: .7;
31 | }
32 |
33 | .hidden {
34 | display: none;
35 | }
36 |
37 | .toolbar-box {
38 | height: 70px;
39 | }
40 |
41 | .toolbar-main {
42 | z-index: 1;
43 | position: fixed;
44 | }
45 |
46 | .toolbar-progress {
47 | z-index: 1;
48 | position: fixed;
49 | top: 64px;
50 | }
51 |
--------------------------------------------------------------------------------
/src/app/movie-item/movie-item.component.spec.ts:
--------------------------------------------------------------------------------
1 | import { async, ComponentFixture, TestBed } from '@angular/core/testing';
2 |
3 | import { MovieItemComponent } from './movie-item.component';
4 |
5 | describe('MovieItemComponent', () => {
6 | let component: MovieItemComponent;
7 | let fixture: ComponentFixture;
8 |
9 | beforeEach(async(() => {
10 | TestBed.configureTestingModule({
11 | declarations: [ MovieItemComponent ]
12 | })
13 | .compileComponents();
14 | }));
15 |
16 | beforeEach(() => {
17 | fixture = TestBed.createComponent(MovieItemComponent);
18 | component = fixture.componentInstance;
19 | fixture.detectChanges();
20 | });
21 |
22 | it('should create', () => {
23 | expect(component).toBeTruthy();
24 | });
25 | });
26 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # See http://help.github.com/ignore-files/ for more about ignoring files.
2 |
3 | # compiled output
4 | /dist
5 | /tmp
6 | /out-tsc
7 | # Only exists if Bazel was run
8 | /bazel-out
9 |
10 | # dependencies
11 | /node_modules
12 |
13 | # profiling files
14 | chrome-profiler-events.json
15 | speed-measure-plugin.json
16 |
17 | # IDEs and editors
18 | /.idea
19 | .project
20 | .classpath
21 | .c9/
22 | *.launch
23 | .settings/
24 | *.sublime-workspace
25 |
26 | # IDE - VSCode
27 | .vscode/*
28 | !.vscode/settings.json
29 | !.vscode/tasks.json
30 | !.vscode/launch.json
31 | !.vscode/extensions.json
32 | .history/*
33 |
34 | # misc
35 | /.sass-cache
36 | /connect.lock
37 | /coverage
38 | /libpeerconnection.log
39 | npm-debug.log
40 | yarn-error.log
41 | testem.log
42 | /typings
43 |
44 | # System Files
45 | .DS_Store
46 | Thumbs.db
47 |
--------------------------------------------------------------------------------
/src/app/entity/subject.ts:
--------------------------------------------------------------------------------
1 | /* tslint:disable:variable-name */
2 | export class Subject {
3 | rating: Rating;
4 | genres: [];
5 | title: string;
6 | casts: Array;
7 | collect_count: number;
8 | original_title: string;
9 | subtype: string;
10 | directors: Array;
11 | year: number;
12 | images: Avatars;
13 | alt: string;
14 | id: string;
15 | }
16 |
17 | export class Rating {
18 | max: number;
19 | average: number;
20 | stars: string;
21 | min: number;
22 | }
23 |
24 | export class Cast {
25 | alt: string;
26 | avatars: Avatars;
27 | name: string;
28 | id: string;
29 | }
30 |
31 | export class Avatars {
32 | small: string;
33 | large: string;
34 | medium: string;
35 | }
36 |
37 | export class Director {
38 | alt: string;
39 | name: string;
40 | id: string;
41 | avatars: Avatars;
42 | }
43 |
--------------------------------------------------------------------------------
/e2e/protractor.conf.js:
--------------------------------------------------------------------------------
1 | // Protractor configuration file, see link for more information
2 | // https://github.com/angular/protractor/blob/master/lib/config.ts
3 |
4 | const { SpecReporter } = require('jasmine-spec-reporter');
5 |
6 | exports.config = {
7 | allScriptsTimeout: 11000,
8 | specs: [
9 | './src/**/*.e2e-spec.ts'
10 | ],
11 | capabilities: {
12 | 'browserName': 'chrome'
13 | },
14 | directConnect: true,
15 | baseUrl: 'http://localhost:4200/',
16 | framework: 'jasmine',
17 | jasmineNodeOpts: {
18 | showColors: true,
19 | defaultTimeoutInterval: 30000,
20 | print: function() {}
21 | },
22 | onPrepare() {
23 | require('ts-node').register({
24 | project: require('path').join(__dirname, './tsconfig.e2e.json')
25 | });
26 | jasmine.getEnv().addReporter(new SpecReporter({ spec: { displayStacktrace: true } }));
27 | }
28 | };
--------------------------------------------------------------------------------
/src/app/service/event.service.ts:
--------------------------------------------------------------------------------
1 | import {Injectable} from '@angular/core';
2 | import {Subject} from 'rxjs';
3 | import {Movie} from '../entity/movie';
4 |
5 | @Injectable({
6 | providedIn: 'root'
7 | })
8 | export class EventService {
9 | changeCardInfoEventSource = new Subject();
10 | hiddenProgressEventSource = new Subject();
11 | nextPageEventSource = new Subject();
12 |
13 | changeCardInfoEvent$ = this.changeCardInfoEventSource.asObservable();
14 | hiddenProgressEvent$ = this.hiddenProgressEventSource.asObservable();
15 | nextPageEvent$ = this.nextPageEventSource.asObservable();
16 |
17 | changeCardInfoEvent(event: string) {
18 | this.changeCardInfoEventSource.next(event);
19 | }
20 |
21 | hiddenProgressEvent(event: boolean) {
22 | this.hiddenProgressEventSource.next(event);
23 | }
24 |
25 | nextPageEvent(event: Movie) {
26 | this.nextPageEventSource.next(event);
27 | }
28 |
29 |
30 | constructor() {
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2017 itning@itning.top
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/src/app/app.component.spec.ts:
--------------------------------------------------------------------------------
1 | import { TestBed, async } from '@angular/core/testing';
2 | import { AppComponent } from './app.component';
3 |
4 | describe('AppComponent', () => {
5 | beforeEach(async(() => {
6 | TestBed.configureTestingModule({
7 | declarations: [
8 | AppComponent
9 | ],
10 | }).compileComponents();
11 | }));
12 |
13 | it('should create the app', () => {
14 | const fixture = TestBed.createComponent(AppComponent);
15 | const app = fixture.debugElement.componentInstance;
16 | expect(app).toBeTruthy();
17 | });
18 |
19 | it(`should have as title 'DouBanMovieForAngular'`, () => {
20 | const fixture = TestBed.createComponent(AppComponent);
21 | const app = fixture.debugElement.componentInstance;
22 | expect(app.title).toEqual('DouBanMovieForAngular');
23 | });
24 |
25 | it('should render title in a h1 tag', () => {
26 | const fixture = TestBed.createComponent(AppComponent);
27 | fixture.detectChanges();
28 | const compiled = fixture.debugElement.nativeElement;
29 | expect(compiled.querySelector('h1').textContent).toContain('Welcome to DouBanMovieForAngular!');
30 | });
31 | });
32 |
--------------------------------------------------------------------------------
/src/karma.conf.js:
--------------------------------------------------------------------------------
1 | // Karma configuration file, see link for more information
2 | // https://karma-runner.github.io/1.0/config/configuration-file.html
3 |
4 | module.exports = function (config) {
5 | config.set({
6 | basePath: '',
7 | frameworks: ['jasmine', '@angular-devkit/build-angular'],
8 | plugins: [
9 | require('karma-jasmine'),
10 | require('karma-chrome-launcher'),
11 | require('karma-jasmine-html-reporter'),
12 | require('karma-coverage-istanbul-reporter'),
13 | require('@angular-devkit/build-angular/plugins/karma')
14 | ],
15 | client: {
16 | clearContext: false // leave Jasmine Spec Runner output visible in browser
17 | },
18 | coverageIstanbulReporter: {
19 | dir: require('path').join(__dirname, '../coverage/DouBanMovieForAngular'),
20 | reports: ['html', 'lcovonly', 'text-summary'],
21 | fixWebpackSourcePaths: true
22 | },
23 | reporters: ['progress', 'kjhtml'],
24 | port: 9876,
25 | colors: true,
26 | logLevel: config.LOG_INFO,
27 | autoWatch: true,
28 | browsers: ['Chrome'],
29 | singleRun: false,
30 | restartOnFileChange: true
31 | });
32 | };
33 |
--------------------------------------------------------------------------------
/src/app/movie/movie.component.ts:
--------------------------------------------------------------------------------
1 | import {Component, NgZone, OnInit} from '@angular/core';
2 | import {ActivatedRoute} from '@angular/router';
3 | import {Movie} from '../entity/movie';
4 | import {EventService} from '../service/event.service';
5 | import {Subject} from '../entity/subject';
6 |
7 | @Component({
8 | selector: 'app-movie',
9 | templateUrl: './movie.component.html',
10 | styleUrls: ['./movie.component.css']
11 | })
12 | export class MovieComponent implements OnInit {
13 | subjects: Array;
14 |
15 | constructor(private activatedRoute: ActivatedRoute, private eventService: EventService, private zone: NgZone) {
16 | }
17 |
18 | ngOnInit() {
19 | this.activatedRoute.params.subscribe((params) => {
20 | this.eventService.changeCardInfoEvent(params.page);
21 | });
22 | this.activatedRoute.data.subscribe((data: { movie: Movie }) => {
23 | this.subjects = data.movie.subjects;
24 | this.eventService.hiddenProgressEvent(true);
25 | });
26 | this.eventService.nextPageEvent$.subscribe((movie: Movie) => {
27 | this.zone.run(() => {
28 | this.subjects = this.subjects.concat(movie.subjects);
29 | this.eventService.hiddenProgressEvent(true);
30 | });
31 | });
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "dou-ban-movie-for-angular",
3 | "version": "1.0.2",
4 | "scripts": {
5 | "ng": "ng",
6 | "start": "ng serve",
7 | "build": "ng build --prod",
8 | "test": "ng test",
9 | "lint": "ng lint",
10 | "e2e": "ng e2e"
11 | },
12 | "private": true,
13 | "dependencies": {
14 | "@angular/animations": "~7.2.0",
15 | "@angular/cdk": "~7.3.7",
16 | "@angular/common": "~7.2.0",
17 | "@angular/compiler": "~7.2.0",
18 | "@angular/core": "~7.2.0",
19 | "@angular/forms": "~7.2.0",
20 | "@angular/material": "^7.3.7",
21 | "@angular/platform-browser": "~7.2.0",
22 | "@angular/platform-browser-dynamic": "~7.2.0",
23 | "@angular/router": "~7.2.0",
24 | "core-js": "^2.5.4",
25 | "hammerjs": "^2.0.8",
26 | "rxjs": "~6.3.3",
27 | "tslib": "^1.9.0",
28 | "zone.js": "~0.8.26"
29 | },
30 | "devDependencies": {
31 | "@angular-devkit/build-angular": "~0.13.0",
32 | "@angular/cli": "~7.3.8",
33 | "@angular/compiler-cli": "~7.2.0",
34 | "@angular/language-service": "~7.2.0",
35 | "@types/node": "~8.9.4",
36 | "@types/jasmine": "~2.8.8",
37 | "@types/jasminewd2": "~2.0.3",
38 | "codelyzer": "~4.5.0",
39 | "jasmine-core": "~2.99.1",
40 | "jasmine-spec-reporter": "~4.2.1",
41 | "karma": "~4.0.0",
42 | "karma-chrome-launcher": "~2.2.0",
43 | "karma-coverage-istanbul-reporter": "~2.0.1",
44 | "karma-jasmine": "~1.1.2",
45 | "karma-jasmine-html-reporter": "^0.2.2",
46 | "protractor": "~5.4.0",
47 | "ts-node": "~7.0.0",
48 | "tslint": "~5.11.0",
49 | "typescript": "~3.2.2"
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/src/app/app.component.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
{{typeMovie}}
6 |
豆瓣电影
7 |
8 |
9 |
10 | whatshot
11 | 正在热映
12 |
13 |
14 | video_library
15 | 即将上映
16 |
17 |
18 | sort
19 | TOP250
20 |
21 |
22 |
23 |
24 |
25 |
36 |
37 |
38 |
39 |
--------------------------------------------------------------------------------
/tslint.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "tslint:recommended",
3 | "rulesDirectory": [
4 | "codelyzer"
5 | ],
6 | "rules": {
7 | "array-type": false,
8 | "arrow-parens": false,
9 | "deprecation": {
10 | "severity": "warn"
11 | },
12 | "import-blacklist": [
13 | true,
14 | "rxjs/Rx"
15 | ],
16 | "interface-name": false,
17 | "max-classes-per-file": false,
18 | "max-line-length": [
19 | true,
20 | 140
21 | ],
22 | "member-access": false,
23 | "member-ordering": [
24 | true,
25 | {
26 | "order": [
27 | "static-field",
28 | "instance-field",
29 | "static-method",
30 | "instance-method"
31 | ]
32 | }
33 | ],
34 | "no-consecutive-blank-lines": false,
35 | "no-console": [
36 | true,
37 | "debug",
38 | "info",
39 | "time",
40 | "timeEnd",
41 | "trace"
42 | ],
43 | "no-empty": false,
44 | "no-inferrable-types": [
45 | true,
46 | "ignore-params"
47 | ],
48 | "no-non-null-assertion": true,
49 | "no-redundant-jsdoc": true,
50 | "no-switch-case-fall-through": true,
51 | "no-use-before-declare": true,
52 | "no-var-requires": false,
53 | "object-literal-key-quotes": [
54 | true,
55 | "as-needed"
56 | ],
57 | "object-literal-sort-keys": false,
58 | "ordered-imports": false,
59 | "quotemark": [
60 | true,
61 | "single"
62 | ],
63 | "trailing-comma": false,
64 | "no-output-on-prefix": true,
65 | "use-input-property-decorator": true,
66 | "use-output-property-decorator": true,
67 | "use-host-property-decorator": true,
68 | "no-input-rename": true,
69 | "no-output-rename": true,
70 | "use-life-cycle-interface": true,
71 | "use-pipe-transform-interface": true,
72 | "component-class-suffix": true,
73 | "directive-class-suffix": true
74 | }
75 | }
76 |
--------------------------------------------------------------------------------
/src/app/app.component.ts:
--------------------------------------------------------------------------------
1 | import {Component, NgZone, OnInit} from '@angular/core';
2 | import {Router} from '@angular/router';
3 | import {CdkScrollable, ScrollDispatcher} from '@angular/cdk/overlay';
4 | import {MovieNetService} from './service/movie-net.service';
5 | import {EventService} from './service/event.service';
6 |
7 |
8 | @Component({
9 | selector: 'app-root',
10 | templateUrl: './app.component.html',
11 | styleUrls: ['./app.component.css']
12 | })
13 | export class AppComponent implements OnInit {
14 | hiddenProgress = false;
15 | opened = false;
16 | typeMovie: string;
17 | cdk: CdkScrollable;
18 |
19 | constructor(private router: Router,
20 | private eventService: EventService,
21 | private scrollDispatcher: ScrollDispatcher,
22 | private movieNetService: MovieNetService,
23 | private zone: NgZone) {
24 | eventService.changeCardInfoEvent$.subscribe(next => {
25 | this.typeMovie = AppComponent.getDesp(next);
26 | });
27 | eventService.hiddenProgressEvent$.subscribe(next => {
28 | this.hiddenProgress = next;
29 | });
30 | scrollDispatcher.scrolled().subscribe((x: CdkScrollable) => {
31 | if (this.hiddenProgress === false) {
32 | return;
33 | }
34 | if (x.measureScrollOffset('bottom') < 300) {
35 | zone.run(() => {
36 | this.hiddenProgress = false;
37 | });
38 | this.cdk = x;
39 | this.movieNetService.nextPage();
40 | }
41 | });
42 | }
43 |
44 | static getDesp(type: string): string {
45 | switch (type) {
46 | case 'in_theaters': {
47 | return '正在热映';
48 | }
49 | case 'coming_soon': {
50 | return '即将上映';
51 | }
52 | case 'top250': {
53 | return 'TOP250';
54 | }
55 | default: {
56 | return '正在热映';
57 | }
58 | }
59 | }
60 |
61 | routerTo(inTheaters: string) {
62 | this.movieNetService.clear(inTheaters);
63 | if (this.cdk !== undefined) {
64 | this.cdk.scrollTo({top: 0});
65 | }
66 | this.router.navigate(['/movie', inTheaters]);
67 | this.opened = !this.opened;
68 | this.typeMovie = AppComponent.getDesp(inTheaters);
69 | }
70 |
71 | refresh() {
72 | window.location.reload();
73 | }
74 |
75 | ngOnInit(): void {
76 | }
77 | }
78 |
--------------------------------------------------------------------------------
/src/app/service/movie-net.service.ts:
--------------------------------------------------------------------------------
1 | import {Injectable, NgZone} from '@angular/core';
2 | import {HttpClient} from '@angular/common/http';
3 | import {Api} from '../api/api';
4 | import {Movie} from '../entity/movie';
5 | import {Observable} from 'rxjs';
6 | import {map} from 'rxjs/operators';
7 | import {Subject} from '../entity/subject';
8 | import {EventService} from './event.service';
9 |
10 | @Injectable({
11 | providedIn: 'root'
12 | })
13 | export class MovieNetService {
14 | parser = document.createElement('a');
15 | page = 1;
16 | count = 15;
17 | total: number;
18 | typeTemp: string;
19 |
20 | constructor(private http: HttpClient, private eventService: EventService, private zone: NgZone) {
21 | }
22 |
23 | clear(type: string) {
24 | this.page = 1;
25 | this.count = 15;
26 | this.total = 0;
27 | this.typeTemp = type;
28 | }
29 |
30 | nextPage() {
31 | if ((this.page * this.count) >= this.total) {
32 | this.zone.run(() => {
33 | this.eventService.hiddenProgressEvent(true);
34 | });
35 | return;
36 | }
37 | this.page++;
38 | const start = this.page === 1 ? 0 : (this.page - 1) * this.count + 1;
39 | this.get(this.typeTemp, start, this.count).subscribe(movie => {
40 | this.eventService.nextPageEvent(movie);
41 | });
42 | }
43 |
44 | get(type: string, start = 0, count = 15): Observable {
45 | let url: string;
46 | switch (type) {
47 | case 'in_theaters': {
48 | url = Api.inTheaters;
49 | break;
50 | }
51 | case 'coming_soon': {
52 | url = Api.comingSoon;
53 | break;
54 | }
55 | case 'top250': {
56 | url = Api.top250;
57 | break;
58 | }
59 | default : {
60 | url = Api.inTheaters;
61 | }
62 | }
63 | this.typeTemp = type;
64 | this.eventService.hiddenProgressEvent(false);
65 | return this.http.jsonp(url + `?start=${start}&count=${count}`, 'callback')
66 | .pipe(map(movie => {
67 | movie.subjects.map((subject: Subject) => {
68 | this.parser.href = subject.images.medium;
69 | subject.images.medium = 'http://img3.doubanio.com' + this.parser.pathname;
70 | return subject;
71 | });
72 | this.total = movie.total;
73 | return movie;
74 | }));
75 | }
76 | }
77 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # DouBanMovieForAngular
2 |
3 | > 使用Angular和豆瓣电影提供的Api创建的电影客户端
4 |
5 | [](https://github.com/itning/DouBanMovieForAngular/stargazers)
6 | [](https://github.com/itning/DouBanMovieForAngular/network/members)
7 | [](https://github.com/itning/DouBanMovieForAngular/watchers)
8 | [](https://github.com/itning?tab=followers)
9 |
10 | [](https://github.com/itning/DouBanMovieForAngular/issues)
11 | [](https://github.com/itning/DouBanMovieForAngular/blob/master/LICENSE)
12 | [](https://github.com/itning/DouBanMovieForAngular/commits)
13 | [](https://github.com/itning/DouBanMovieForAngular/releases)
14 | [](https://github.com/itning/DouBanMovieForAngular)
15 | [](http://hits.dwyl.io/itning/DouBanMovieForAngular)
16 | [](https://github.com/itning/DouBanMovieForAngular)
17 |
18 | This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 7.3.8.
19 |
20 | ## Development server
21 |
22 | Run `ng serve` for a dev server. Navigate to `http://localhost:4200/`. The app will automatically reload if you change any of the source files.
23 |
24 | ## Code scaffolding
25 |
26 | Run `ng generate component component-name` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module`.
27 |
28 | ## Build
29 |
30 | Run `ng build` to build the project. The build artifacts will be stored in the `dist/` directory. Use the `--prod` flag for a production build.
31 |
32 | ## Running unit tests
33 |
34 | Run `ng test` to execute the unit tests via [Karma](https://karma-runner.github.io).
35 |
36 | ## Running end-to-end tests
37 |
38 | Run `ng e2e` to execute the end-to-end tests via [Protractor](http://www.protractortest.org/).
39 |
40 | ## Further help
41 |
42 | To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI README](https://github.com/angular/angular-cli/blob/master/README.md).
43 |
44 | 
45 | 
46 |
--------------------------------------------------------------------------------
/src/polyfills.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * This file includes polyfills needed by Angular and is loaded before the app.
3 | * You can add your own extra polyfills to this file.
4 | *
5 | * This file is divided into 2 sections:
6 | * 1. Browser polyfills. These are applied before loading ZoneJS and are sorted by browsers.
7 | * 2. Application imports. Files imported after ZoneJS that should be loaded before your main
8 | * file.
9 | *
10 | * The current setup is for so-called "evergreen" browsers; the last versions of browsers that
11 | * automatically update themselves. This includes Safari >= 10, Chrome >= 55 (including Opera),
12 | * Edge >= 13 on the desktop, and iOS 10 and Chrome on mobile.
13 | *
14 | * Learn more in https://angular.io/guide/browser-support
15 | */
16 |
17 | /***************************************************************************************************
18 | * BROWSER POLYFILLS
19 | */
20 |
21 | /** IE10 and IE11 requires the following for NgClass support on SVG elements */
22 | // import 'classlist.js'; // Run `npm install --save classlist.js`.
23 |
24 | /**
25 | * Web Animations `@angular/platform-browser/animations`
26 | * Only required if AnimationBuilder is used within the application and using IE/Edge or Safari.
27 | * Standard animation support in Angular DOES NOT require any polyfills (as of Angular 6.0).
28 | */
29 | // import 'web-animations-js'; // Run `npm install --save web-animations-js`.
30 |
31 | /**
32 | * By default, zone.js will patch all possible macroTask and DomEvents
33 | * user can disable parts of macroTask/DomEvents patch by setting following flags
34 | * because those flags need to be set before `zone.js` being loaded, and webpack
35 | * will put import in the top of bundle, so user need to create a separate file
36 | * in this directory (for example: zone-flags.ts), and put the following flags
37 | * into that file, and then add the following code before importing zone.js.
38 | * import './zone-flags.ts';
39 | *
40 | * The flags allowed in zone-flags.ts are listed here.
41 | *
42 | * The following flags will work for all browsers.
43 | *
44 | * (window as any).__Zone_disable_requestAnimationFrame = true; // disable patch requestAnimationFrame
45 | * (window as any).__Zone_disable_on_property = true; // disable patch onProperty such as onclick
46 | * (window as any).__zone_symbol__BLACK_LISTED_EVENTS = ['scroll', 'mousemove']; // disable patch specified eventNames
47 | *
48 | * in IE/Edge developer tools, the addEventListener will also be wrapped by zone.js
49 | * with the following flag, it will bypass `zone.js` patch for IE/Edge
50 | *
51 | * (window as any).__Zone_enable_cross_context_check = true;
52 | *
53 | */
54 |
55 | /***************************************************************************************************
56 | * Zone JS is required by default for Angular itself.
57 | */
58 | import 'zone.js/dist/zone'; // Included with Angular CLI.
59 |
60 |
61 | /***************************************************************************************************
62 | * APPLICATION IMPORTS
63 | */
64 |
--------------------------------------------------------------------------------
/src/app/app.module.ts:
--------------------------------------------------------------------------------
1 | import {BrowserModule} from '@angular/platform-browser';
2 | import {NgModule} from '@angular/core';
3 |
4 | import {AppComponent} from './app.component';
5 | import {BrowserAnimationsModule} from '@angular/platform-browser/animations';
6 | import {
7 | MatAutocompleteModule,
8 | MatBadgeModule,
9 | MatBottomSheetModule,
10 | MatButtonModule,
11 | MatButtonToggleModule,
12 | MatCardModule,
13 | MatCheckboxModule,
14 | MatChipsModule,
15 | MatDatepickerModule,
16 | MatDialogModule,
17 | MatDividerModule,
18 | MatExpansionModule,
19 | MatGridListModule,
20 | MatIconModule,
21 | MatInputModule,
22 | MatListModule,
23 | MatMenuModule,
24 | MatNativeDateModule,
25 | MatPaginatorModule,
26 | MatProgressBarModule,
27 | MatProgressSpinnerModule,
28 | MatRadioModule,
29 | MatRippleModule,
30 | MatSelectModule,
31 | MatSidenavModule,
32 | MatSliderModule,
33 | MatSlideToggleModule,
34 | MatSnackBarModule,
35 | MatSortModule,
36 | MatStepperModule,
37 | MatTableModule,
38 | MatTabsModule,
39 | MatToolbarModule,
40 | MatTooltipModule,
41 | MatTreeModule,
42 | } from '@angular/material';
43 | import {MovieComponent} from './movie/movie.component';
44 | import {MovieItemComponent} from './movie-item/movie-item.component';
45 | import {AppRoutingModule} from './router/app-routing.module';
46 | import {FormsModule} from '@angular/forms';
47 | import {HttpClientJsonpModule, HttpClientModule} from '@angular/common/http';
48 | import {MovieNetService} from './service/movie-net.service';
49 | import {DirectorsPipe} from './pipe/directors.pipe';
50 | import {EventService} from './service/event.service';
51 |
52 | @NgModule({
53 | declarations: [
54 | AppComponent,
55 | MovieComponent,
56 | MovieItemComponent,
57 | DirectorsPipe
58 | ],
59 | imports: [
60 | BrowserModule,
61 | BrowserAnimationsModule,
62 | MatAutocompleteModule,
63 | MatBadgeModule,
64 | MatBottomSheetModule,
65 | MatButtonModule,
66 | MatButtonToggleModule,
67 | MatCardModule,
68 | MatCheckboxModule,
69 | MatChipsModule,
70 | MatStepperModule,
71 | MatDatepickerModule,
72 | MatDialogModule,
73 | MatDividerModule,
74 | MatExpansionModule,
75 | MatGridListModule,
76 | MatIconModule,
77 | MatInputModule,
78 | MatListModule,
79 | MatMenuModule,
80 | MatNativeDateModule,
81 | MatPaginatorModule,
82 | MatProgressBarModule,
83 | MatProgressSpinnerModule,
84 | MatRadioModule,
85 | MatRippleModule,
86 | MatSelectModule,
87 | MatSidenavModule,
88 | MatSliderModule,
89 | MatSlideToggleModule,
90 | MatSnackBarModule,
91 | MatSortModule,
92 | MatTableModule,
93 | MatTabsModule,
94 | MatToolbarModule,
95 | MatTooltipModule,
96 | MatTreeModule,
97 | AppRoutingModule,
98 | FormsModule,
99 | HttpClientModule,
100 | HttpClientJsonpModule
101 | ],
102 | providers: [MovieNetService, EventService],
103 | bootstrap: [AppComponent]
104 | })
105 | export class AppModule {
106 | }
107 |
--------------------------------------------------------------------------------
/angular.json:
--------------------------------------------------------------------------------
1 | {
2 | "$schema": "./node_modules/@angular/cli/lib/config/schema.json",
3 | "version": 1,
4 | "newProjectRoot": "projects",
5 | "projects": {
6 | "DouBanMovieForAngular": {
7 | "root": "",
8 | "sourceRoot": "src",
9 | "projectType": "application",
10 | "prefix": "app",
11 | "schematics": {},
12 | "architect": {
13 | "build": {
14 | "builder": "@angular-devkit/build-angular:browser",
15 | "options": {
16 | "outputPath": "dist/DouBanMovieForAngular",
17 | "index": "src/index.html",
18 | "main": "src/main.ts",
19 | "polyfills": "src/polyfills.ts",
20 | "tsConfig": "src/tsconfig.app.json",
21 | "assets": [
22 | "src/favicon.ico",
23 | "src/assets"
24 | ],
25 | "styles": [
26 | "./node_modules/@angular/material/prebuilt-themes/indigo-pink.css",
27 | "src/styles.css"
28 | ],
29 | "scripts": [],
30 | "es5BrowserSupport": true
31 | },
32 | "configurations": {
33 | "production": {
34 | "fileReplacements": [
35 | {
36 | "replace": "src/environments/environment.ts",
37 | "with": "src/environments/environment.prod.ts"
38 | }
39 | ],
40 | "optimization": true,
41 | "outputHashing": "all",
42 | "sourceMap": false,
43 | "extractCss": true,
44 | "namedChunks": false,
45 | "aot": true,
46 | "extractLicenses": true,
47 | "vendorChunk": false,
48 | "buildOptimizer": true,
49 | "budgets": [
50 | {
51 | "type": "initial",
52 | "maximumWarning": "2mb",
53 | "maximumError": "5mb"
54 | }
55 | ]
56 | }
57 | }
58 | },
59 | "serve": {
60 | "builder": "@angular-devkit/build-angular:dev-server",
61 | "options": {
62 | "browserTarget": "DouBanMovieForAngular:build"
63 | },
64 | "configurations": {
65 | "production": {
66 | "browserTarget": "DouBanMovieForAngular:build:production"
67 | }
68 | }
69 | },
70 | "extract-i18n": {
71 | "builder": "@angular-devkit/build-angular:extract-i18n",
72 | "options": {
73 | "browserTarget": "DouBanMovieForAngular:build"
74 | }
75 | },
76 | "test": {
77 | "builder": "@angular-devkit/build-angular:karma",
78 | "options": {
79 | "main": "src/test.ts",
80 | "polyfills": "src/polyfills.ts",
81 | "tsConfig": "src/tsconfig.spec.json",
82 | "karmaConfig": "src/karma.conf.js",
83 | "styles": [
84 | "./node_modules/@angular/material/prebuilt-themes/indigo-pink.css",
85 | "src/styles.css"
86 | ],
87 | "scripts": [],
88 | "assets": [
89 | "src/favicon.ico",
90 | "src/assets"
91 | ]
92 | }
93 | },
94 | "lint": {
95 | "builder": "@angular-devkit/build-angular:tslint",
96 | "options": {
97 | "tsConfig": [
98 | "src/tsconfig.app.json",
99 | "src/tsconfig.spec.json"
100 | ],
101 | "exclude": [
102 | "**/node_modules/**"
103 | ]
104 | }
105 | }
106 | }
107 | },
108 | "DouBanMovieForAngular-e2e": {
109 | "root": "e2e/",
110 | "projectType": "application",
111 | "prefix": "",
112 | "architect": {
113 | "e2e": {
114 | "builder": "@angular-devkit/build-angular:protractor",
115 | "options": {
116 | "protractorConfig": "e2e/protractor.conf.js",
117 | "devServerTarget": "DouBanMovieForAngular:serve"
118 | },
119 | "configurations": {
120 | "production": {
121 | "devServerTarget": "DouBanMovieForAngular:serve:production"
122 | }
123 | }
124 | },
125 | "lint": {
126 | "builder": "@angular-devkit/build-angular:tslint",
127 | "options": {
128 | "tsConfig": "e2e/tsconfig.e2e.json",
129 | "exclude": [
130 | "**/node_modules/**"
131 | ]
132 | }
133 | }
134 | }
135 | }
136 | },
137 | "defaultProject": "DouBanMovieForAngular"
138 | }
--------------------------------------------------------------------------------