Angular 2 Component for SOS Gallery
<user-info>
is a component that we can use for shows user's information and change the language of our application.
How to install
Open your Angular 2 Project and execute this:
npm install sos-user-info
Configuration
To use sos-user-info, You should write the following into your application's NgModule:
import {UserInfoComponent, TRANSLATION_PROVIDERS, TranslatePipe, TranslateService} from 'sos-user-info';
@NgModule({
declarations: [UserInfoComponent,TranslatePipe],
providers: [TranslateService,TRANSLATION_PROVIDERS],
...
})
export class MyAppModule {}
Simple example
<user-info
[Nombrevalue]="variable_name"
[Rolvalue]="variable_rol"
[Accessvalue]="variable_access">
</user-info>
- Nombrevalue Shows the user name
- Rolvalue Shows the Rol of user..
- Accessvalue Shows the Nivel of Access of user.
After that in our Component we are going to need three variables to set their values.
export class AppComponent {
variable_name:string="User Name";
variable_rol:string ="Rol";
variable_access:string="Access";
}
how to use the translator
Just you need use these sentences for the component recognize where to translate. We can use them in anywhere into our application.
<strong>{{ 'home' | translate }}</strong>
<strong>{{ 'typography' | translate }}</strong>
<strong>{{ 'layout' | translate }}</strong>