Git Product home page Git Product logo

title's Introduction

Title module based on the @ngx-translate/core package.

Installation

yarn add @ngsm/title or npm i @ngsm/title --save

Requirements

Library requires @ngx-translate/core, you can use also @ngsm/i18n module.

Usage

App module:

import { I18nModule } from '@ngsm/i18n';
import { TitleModule } from '@ngsm/title';
...

@NgModule({
  imports: [
    ...
    TitleModule,
    I18nModule,
  ],
  ...
})
export class AppModule {}

Single routing:

const routes: Routes = [
  {
    path: '',
    component: MyPageComponent,
    data: {
      title: 'title.myPage',
    },
  },
];

...

Translations should be added in i18n directory in your assets (for example /src/assets/i18n/en.json):

{
  "title": {
    "myPage": "Here is my title",
    "default": "My default title",
    "suffix": "My title suffix"
  }
}

Author

Sebastian Musiał

[email protected]

@sebamusial

title's People

Contributors

dependabot[bot] avatar sebastianmusial avatar

Stargazers

 avatar  avatar

Watchers

 avatar

Forkers

leo-yujie

title's Issues

NullInjectorError: No provider for TranslateService!

I'm submitting a ... (check one with "x")

  • bug report => check the FAQ and search github for a similar issue or PR before submitting

  • support request => check the FAQ and search github for a similar issue before submitting

  • feature reques

Current behavior
I followed the installation and usage steps for ngx-translate but I get this error :

Error: No provider for TranslateService!

AppRoutingModule
export const routes: Routes = [ { path: '', redirectTo: 'dashboard', pathMatch: 'full', }, { path: '404', component: P404Component, data: { title: 'title.404PAGE' } }]
AppRoutingModule
imports: [ RouterModule.forRoot(routes) ,TranslateModule.forRoot(), TitleModule]

Compability with Angular Ivy

I am trying to add this module to app based on Angular 9 (with ivy). I am getting this error:

    ERROR in node_modules/@ngsm/title/lib/title.module.d.ts:4:22 - error NG6002: Appears in the NgModule.imports of AppModule, but could not be resolved to an NgModule class.
    
    This likely means that the library (@ngsm/title) which declares TitleModule has not been processed correctly by ngcc, or is not compatible with Angular Ivy. Check if a newer version of the library is available, and update if so. Also consider checking with
the library's authors to see if the library is expected to be compatible with Ivy.
    
    4 export declare class TitleModule {
                           ~~~~~~~~~~~
    

Module is imported with: import { TitleModule } from '@ngsm/title';, I am not using @ngsm/i18n

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.