├── .editorconfig
├── .gitignore
├── LICENSE
├── README.md
├── angular.json
├── package-lock.json
├── package.json
├── src
├── app
│ ├── app.component.spec.ts
│ ├── app.component.ts
│ └── app.module.ts
├── assets
│ ├── .gitkeep
│ └── i18n
│ │ ├── en.json
│ │ └── fr.json
├── browserslist
├── environments
│ ├── environment.prod.ts
│ └── environment.ts
├── favicon.ico
├── index.html
├── karma.conf.js
├── main.ts
├── polyfills.ts
├── styles.css
├── test.ts
├── tsconfig.app.json
├── tsconfig.spec.json
└── tslint.json
├── tsconfig.json
└── tslint.json
/.editorconfig:
--------------------------------------------------------------------------------
1 | # Editor configuration, see http://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 |
--------------------------------------------------------------------------------
/.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 |
8 | # dependencies
9 | /node_modules
10 |
11 | # IDEs and editors
12 | /.idea
13 | .project
14 | .classpath
15 | .c9/
16 | *.launch
17 | .settings/
18 | *.sublime-workspace
19 |
20 | # IDE - VSCode
21 | .vscode/*
22 | !.vscode/settings.json
23 | !.vscode/tasks.json
24 | !.vscode/launch.json
25 | !.vscode/extensions.json
26 |
27 | # misc
28 | /.sass-cache
29 | /connect.lock
30 | /coverage
31 | /libpeerconnection.log
32 | npm-debug.log
33 | yarn-error.log
34 | testem.log
35 | /typings
36 |
37 | # System Files
38 | .DS_Store
39 | Thumbs.db
40 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | Copyright (c) 2018 Olivier Combe
2 |
3 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4 |
5 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
6 |
7 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
8 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # ngx-translate example
2 |
3 | ## Development server
4 |
5 | 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.
6 |
7 | ## Code scaffolding
8 |
9 | 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`.
10 |
11 | ## Build
12 |
13 | 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.
14 |
15 | ## Running unit tests
16 |
17 | Run `ng test` to execute the unit tests via [Karma](https://karma-runner.github.io).
18 |
19 | ## Further help
20 |
21 | 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).
22 |
--------------------------------------------------------------------------------
/angular.json:
--------------------------------------------------------------------------------
1 | {
2 | "$schema": "./node_modules/@angular/cli/lib/config/schema.json",
3 | "version": 1,
4 | "newProjectRoot": "projects",
5 | "projects": {
6 | "ngx-translate": {
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/ngx-translate",
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 | "src/styles.css"
27 | ],
28 | "scripts": []
29 | },
30 | "configurations": {
31 | "production": {
32 | "fileReplacements": [
33 | {
34 | "replace": "src/environments/environment.ts",
35 | "with": "src/environments/environment.prod.ts"
36 | }
37 | ],
38 | "optimization": true,
39 | "outputHashing": "all",
40 | "sourceMap": false,
41 | "extractCss": true,
42 | "namedChunks": false,
43 | "aot": true,
44 | "extractLicenses": true,
45 | "vendorChunk": false,
46 | "buildOptimizer": true
47 | }
48 | }
49 | },
50 | "serve": {
51 | "builder": "@angular-devkit/build-angular:dev-server",
52 | "options": {
53 | "browserTarget": "ngx-translate:build"
54 | },
55 | "configurations": {
56 | "production": {
57 | "browserTarget": "ngx-translate:build:production"
58 | }
59 | }
60 | },
61 | "test": {
62 | "builder": "@angular-devkit/build-angular:karma",
63 | "options": {
64 | "main": "src/test.ts",
65 | "polyfills": "src/polyfills.ts",
66 | "tsConfig": "src/tsconfig.spec.json",
67 | "karmaConfig": "src/karma.conf.js",
68 | "styles": [
69 | "styles.css"
70 | ],
71 | "scripts": [],
72 | "assets": [
73 | "src/favicon.ico",
74 | "src/assets"
75 | ]
76 | }
77 | },
78 | "lint": {
79 | "builder": "@angular-devkit/build-angular:tslint",
80 | "options": {
81 | "tsConfig": [
82 | "src/tsconfig.app.json",
83 | "src/tsconfig.spec.json"
84 | ],
85 | "exclude": [
86 | "**/node_modules/**"
87 | ]
88 | }
89 | }
90 | }
91 | }
92 | },
93 | "defaultProject": "ngx-translate"
94 | }
95 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "ngx-translate",
3 | "description": "The internationalization (i18n) library for Angular",
4 | "private": true,
5 | "scripts": {
6 | "build": "ng build",
7 | "lint": "ng lint",
8 | "start": "ng serve",
9 | "test": "ng test"
10 | },
11 | "dependencies": {
12 | "@angular/common": "^7.0.4",
13 | "@angular/compiler": "^7.0.4",
14 | "@angular/core": "^7.0.4",
15 | "@angular/platform-browser": "^7.0.4",
16 | "@angular/platform-browser-dynamic": "^7.0.4",
17 | "@ngx-translate/core": "^11.0.1",
18 | "@ngx-translate/http-loader": "^4.0.0",
19 | "core-js": "^2.5.4",
20 | "rxjs": "^6.3.3",
21 | "zone.js": "^0.8.26"
22 | },
23 | "devDependencies": {
24 | "@angular-devkit/build-angular": "^0.10.6",
25 | "@angular/cli": "7.0.6",
26 | "@angular/compiler-cli": "^7.0.4",
27 | "@angular/language-service": "^7.0.4",
28 | "@types/jasmine": "~2.8.7",
29 | "@types/jasminewd2": "~2.0.3",
30 | "@types/node": "~8.9.4",
31 | "codelyzer": "~4.5.0",
32 | "jasmine-core": "~2.99.1",
33 | "jasmine-spec-reporter": "~4.2.1",
34 | "karma": "~1.7.1",
35 | "karma-chrome-launcher": "~2.2.0",
36 | "karma-coverage-istanbul-reporter": "~1.4.2",
37 | "karma-jasmine": "~1.1.1",
38 | "karma-jasmine-html-reporter": "^0.2.2",
39 | "karma-mocha-reporter": "^2.2.5",
40 | "ts-node": "~7.0.1",
41 | "tslib": "^1.7.1",
42 | "tslint": "~5.11.0",
43 | "typescript": "3.1.6"
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/src/app/app.component.spec.ts:
--------------------------------------------------------------------------------
1 | import {HttpClient} from "@angular/common/http";
2 | import {HttpClientTestingModule, HttpTestingController} from "@angular/common/http/testing";
3 | import {async, TestBed} from '@angular/core/testing';
4 | import {TranslateLoader, TranslateModule, TranslateService} from "@ngx-translate/core";
5 | import {AppComponent} from './app.component';
6 | import {HttpLoaderFactory} from "./app.module";
7 |
8 | const TRANSLATIONS_EN = require('../assets/i18n/en.json');
9 | const TRANSLATIONS_FR = require('../assets/i18n/fr.json');
10 |
11 | describe('AppComponent', () => {
12 | let translate: TranslateService;
13 | let http: HttpTestingController;
14 |
15 | beforeEach(async(() => {
16 | TestBed.configureTestingModule({
17 | declarations: [
18 | AppComponent
19 | ],
20 | imports: [
21 | HttpClientTestingModule,
22 | TranslateModule.forRoot({
23 | loader: {
24 | provide: TranslateLoader,
25 | useFactory: HttpLoaderFactory,
26 | deps: [HttpClient]
27 | }
28 | })
29 | ],
30 | providers: [TranslateService]
31 | }).compileComponents();
32 | translate = TestBed.get(TranslateService);
33 | http = TestBed.get(HttpTestingController);
34 | }));
35 |
36 | it('should create the app', async(() => {
37 | const fixture = TestBed.createComponent(AppComponent);
38 | const app = fixture.debugElement.componentInstance;
39 | expect(app).toBeTruthy();
40 | }));
41 |
42 | it('should load translations', async(() => {
43 | spyOn(translate, 'getBrowserLang').and.returnValue('en');
44 | const fixture = TestBed.createComponent(AppComponent);
45 | const compiled = fixture.debugElement.nativeElement;
46 |
47 | // the DOM should be empty for now since the translations haven't been rendered yet
48 | expect(compiled.querySelector('h2').textContent).toEqual('');
49 |
50 | http.expectOne('/assets/i18n/en.json').flush(TRANSLATIONS_EN);
51 | http.expectNone('/assets/i18n/fr.json');
52 |
53 | // Finally, assert that there are no outstanding requests.
54 | http.verify();
55 |
56 | fixture.detectChanges();
57 | // the content should be translated to english now
58 | expect(compiled.querySelector('h2').textContent).toEqual(TRANSLATIONS_EN.HOME.TITLE);
59 |
60 | translate.use('fr');
61 | http.expectOne('/assets/i18n/fr.json').flush(TRANSLATIONS_FR);
62 |
63 | // Finally, assert that there are no outstanding requests.
64 | http.verify();
65 |
66 | // the content has not changed yet
67 | expect(compiled.querySelector('h2').textContent).toEqual(TRANSLATIONS_EN.HOME.TITLE);
68 |
69 | fixture.detectChanges();
70 | // the content should be translated to french now
71 | expect(compiled.querySelector('h2').textContent).toEqual(TRANSLATIONS_FR.HOME.TITLE);
72 | }));
73 | });
74 |
--------------------------------------------------------------------------------
/src/app/app.component.ts:
--------------------------------------------------------------------------------
1 | import {Component} from '@angular/core';
2 | import {TranslateService} from '@ngx-translate/core';
3 |
4 | @Component({
5 | selector: 'app-root',
6 | template: `
7 |
8 |
{{ 'HOME.TITLE' | translate }}
9 |
15 |
16 | `,
17 | })
18 | export class AppComponent {
19 | constructor(public translate: TranslateService) {
20 | translate.addLangs(['en', 'fr']);
21 | translate.setDefaultLang('en');
22 |
23 | const browserLang = translate.getBrowserLang();
24 | translate.use(browserLang.match(/en|fr/) ? browserLang : 'en');
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/src/app/app.module.ts:
--------------------------------------------------------------------------------
1 | import { BrowserModule } from '@angular/platform-browser';
2 | import { NgModule } from '@angular/core';
3 | import { AppComponent } from './app.component';
4 | import {HttpClient, HttpClientModule} from '@angular/common/http';
5 | import {TranslateModule, TranslateLoader} from '@ngx-translate/core';
6 | import {TranslateHttpLoader} from '@ngx-translate/http-loader';
7 |
8 | // AoT requires an exported function for factories
9 | export function HttpLoaderFactory(httpClient: HttpClient) {
10 | return new TranslateHttpLoader(httpClient);
11 | }
12 |
13 | @NgModule({
14 | declarations: [
15 | AppComponent
16 | ],
17 | imports: [
18 | BrowserModule,
19 | HttpClientModule,
20 | TranslateModule.forRoot({
21 | loader: {
22 | provide: TranslateLoader,
23 | useFactory: HttpLoaderFactory,
24 | deps: [HttpClient]
25 | }
26 | })
27 | ],
28 | providers: [],
29 | bootstrap: [AppComponent]
30 | })
31 | export class AppModule { }
32 |
--------------------------------------------------------------------------------
/src/assets/.gitkeep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ngx-translate/example/6b41856ab9a7b3f6c1f30b6edb737ab245155114/src/assets/.gitkeep
--------------------------------------------------------------------------------
/src/assets/i18n/en.json:
--------------------------------------------------------------------------------
1 | {
2 | "HOME": {
3 | "TITLE": "Hello Angular with ngx-translate!",
4 | "SELECT": "Change language"
5 | }
6 | }
7 |
--------------------------------------------------------------------------------
/src/assets/i18n/fr.json:
--------------------------------------------------------------------------------
1 | {
2 | "HOME": {
3 | "TITLE": "Bonjour Angular avec ngx-translate !",
4 | "SELECT": "Changer la langue"
5 | }
6 | }
7 |
--------------------------------------------------------------------------------
/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 | # For IE 9-11 support, please uncomment the last line of the file and adjust as needed
5 | > 0.5%
6 | last 2 versions
7 | Firefox ESR
8 | not dead
9 | # IE 9-11
--------------------------------------------------------------------------------
/src/environments/environment.prod.ts:
--------------------------------------------------------------------------------
1 | export const environment = {
2 | production: true
3 | };
4 |
--------------------------------------------------------------------------------
/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 | * In development mode, to ignore zone related error stack frames such as
11 | * `zone.run`, `zoneDelegate.invokeTask` for easier debugging, you can
12 | * import the following file, but please comment it out in production mode
13 | * because it will have performance impact when throw error
14 | */
15 | // import 'zone.js/dist/zone-error'; // Included with Angular CLI.
16 |
--------------------------------------------------------------------------------
/src/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ngx-translate/example/6b41856ab9a7b3f6c1f30b6edb737ab245155114/src/favicon.ico
--------------------------------------------------------------------------------
/src/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | @ngx-translate demo
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/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 | var configuration = {
6 | basePath: '',
7 | frameworks: ['jasmine', '@angular-devkit/build-angular'],
8 | plugins: [
9 | 'karma-jasmine',
10 | 'karma-chrome-launcher',
11 | 'karma-mocha-reporter',
12 | 'karma-coverage-istanbul-reporter',
13 | '@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'),
20 | reports: ['html', 'lcovonly'],
21 | fixWebpackSourcePaths: true
22 | },
23 | reporters: ['mocha'],
24 | mochaReporter: {
25 | ignoreSkipped: true
26 | },
27 | port: 9876,
28 | colors: true,
29 | logLevel: config.LOG_INFO,
30 | autoWatch: true,
31 | browsers: ['Chrome'],
32 | customLaunchers: {
33 | ChromeTravisCi: {
34 | base: 'Chrome',
35 | flags: ['--no-sandbox']
36 | }
37 | },
38 | singleRun: false
39 | };
40 |
41 | if (process.env.TRAVIS){
42 | config.browsers = [
43 | 'ChromeTravisCi'
44 | ];
45 | }
46 |
47 | config.set(configuration);
48 | };
49 |
--------------------------------------------------------------------------------
/src/main.ts:
--------------------------------------------------------------------------------
1 | import { enableProdMode } from '@angular/core';
2 | import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
3 |
4 | import { AppModule } from './app/app.module';
5 | import { environment } from './environments/environment';
6 |
7 | if (environment.production) {
8 | enableProdMode();
9 | }
10 |
11 | platformBrowserDynamic().bootstrapModule(AppModule)
12 | .catch(err => console.log(err));
13 |
--------------------------------------------------------------------------------
/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/docs/ts/latest/guide/browser-support.html
15 | */
16 |
17 | /***************************************************************************************************
18 | * BROWSER POLYFILLS
19 | */
20 |
21 | /** IE9, IE10 and IE11 requires all of the following polyfills. **/
22 | // import 'core-js/es6/symbol';
23 | // import 'core-js/es6/object';
24 | // import 'core-js/es6/function';
25 | // import 'core-js/es6/parse-int';
26 | // import 'core-js/es6/parse-float';
27 | // import 'core-js/es6/number';
28 | // import 'core-js/es6/math';
29 | // import 'core-js/es6/string';
30 | // import 'core-js/es6/date';
31 | // import 'core-js/es6/array';
32 | // import 'core-js/es6/regexp';
33 | // import 'core-js/es6/map';
34 | // import 'core-js/es6/weak-map';
35 | // import 'core-js/es6/set';
36 |
37 | /** IE10 and IE11 requires the following for NgClass support on SVG elements */
38 | // import 'classlist.js'; // Run `npm install --save classlist.js`.
39 |
40 | /** IE10 and IE11 requires the following for the Reflect API. */
41 | // import 'core-js/es6/reflect';
42 |
43 |
44 | /** Evergreen browsers require these. **/
45 | // Used for reflect-metadata in JIT. If you use AOT (and only Angular decorators), you can remove.
46 | import 'core-js/es7/reflect';
47 |
48 |
49 | /**
50 | * Web Animations `@angular/platform-browser/animations`
51 | * Only required if AnimationBuilder is used within the application and using IE/Edge or Safari.
52 | * Standard animation support in Angular DOES NOT require any polyfills (as of Angular 6.0).
53 | **/
54 | // import 'web-animations-js'; // Run `npm install --save web-animations-js`.
55 |
56 | /**
57 | * By default, zone.js will patch all possible macroTask and DomEvents
58 | * user can disable parts of macroTask/DomEvents patch by setting following flags
59 | */
60 |
61 | // (window as any).__Zone_disable_requestAnimationFrame = true; // disable patch requestAnimationFrame
62 | // (window as any).__Zone_disable_on_property = true; // disable patch onProperty such as onclick
63 | // (window as any).__zone_symbol__BLACK_LISTED_EVENTS = ['scroll', 'mousemove']; // disable patch specified eventNames
64 |
65 | /*
66 | * in IE/Edge developer tools, the addEventListener will also be wrapped by zone.js
67 | * with the following flag, it will bypass `zone.js` patch for IE/Edge
68 | */
69 | // (window as any).__Zone_enable_cross_context_check = true;
70 |
71 | /***************************************************************************************************
72 | * Zone JS is required by default for Angular itself.
73 | */
74 | import 'zone.js/dist/zone'; // Included with Angular CLI.
75 |
76 |
77 |
78 | /***************************************************************************************************
79 | * APPLICATION IMPORTS
80 | */
81 |
--------------------------------------------------------------------------------
/src/styles.css:
--------------------------------------------------------------------------------
1 | /* You can add global styles to this file, and also import other style files */
2 |
--------------------------------------------------------------------------------
/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/tsconfig.app.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "../tsconfig.json",
3 | "compilerOptions": {
4 | "outDir": "../out-tsc/app",
5 | "module": "es2015",
6 | "types": []
7 | },
8 | "exclude": [
9 | "src/test.ts",
10 | "**/*.spec.ts"
11 | ]
12 | }
13 |
--------------------------------------------------------------------------------
/src/tsconfig.spec.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "../tsconfig.json",
3 | "compilerOptions": {
4 | "outDir": "../out-tsc/spec",
5 | "module": "commonjs",
6 | "types": [
7 | "jasmine",
8 | "node"
9 | ]
10 | },
11 | "files": [
12 | "test.ts",
13 | "polyfills.ts"
14 | ],
15 | "include": [
16 | "**/*.spec.ts",
17 | "**/*.d.ts"
18 | ]
19 | }
20 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compileOnSave": false,
3 | "compilerOptions": {
4 | "baseUrl": "./",
5 | "outDir": "./dist/out-tsc",
6 | "sourceMap": true,
7 | "declaration": false,
8 | "moduleResolution": "node",
9 | "emitDecoratorMetadata": true,
10 | "experimentalDecorators": true,
11 | "target": "es5",
12 | "typeRoots": [
13 | "node_modules/@types"
14 | ],
15 | "lib": [
16 | "es2017",
17 | "dom"
18 | ]
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/tslint.json:
--------------------------------------------------------------------------------
1 | {
2 | "rulesDirectory": [
3 | "node_modules/codelyzer"
4 | ],
5 | "rules": {
6 | "class-name": true,
7 | "curly": true,
8 | "forin": true,
9 | "indent": [
10 | true,
11 | "spaces"
12 | ],
13 | "label-position": true,
14 | "member-access": false,
15 | "no-arg": true,
16 | "no-bitwise": true,
17 | "no-console": [
18 | true,
19 | "debug",
20 | "info",
21 | "time",
22 | "timeEnd",
23 | "trace"
24 | ],
25 | "no-construct": true,
26 | "no-duplicate-variable": true,
27 | "no-empty": false,
28 | "no-eval": true,
29 | "no-inferrable-types": false,
30 | "no-shadowed-variable": true,
31 | "no-string-literal": false,
32 | "no-unused-expression": true,
33 | "object-literal-sort-keys": false,
34 | "one-line": [
35 | true,
36 | "check-open-brace",
37 | "check-catch",
38 | "check-else",
39 | "check-whitespace"
40 | ],
41 | "radix": true,
42 | "semicolon": [
43 | "always"
44 | ],
45 | "triple-equals": [
46 | true,
47 | "allow-null-check"
48 | ],
49 | "typedef-whitespace": [
50 | true,
51 | {
52 | "call-signature": "nospace",
53 | "index-signature": "nospace",
54 | "parameter": "nospace",
55 | "property-declaration": "nospace",
56 | "variable-declaration": "nospace"
57 | }
58 | ],
59 | "variable-name": false,
60 | "use-input-property-decorator": true,
61 | "use-output-property-decorator": true,
62 | "use-host-property-decorator": false,
63 | "use-pipe-transform-interface": true
64 | }
65 | }
66 |
--------------------------------------------------------------------------------