Browse Source

Update theming.md

pull/23275/head
Fahri Gedik 1 year ago
parent
commit
9c2a5606fb
  1. 42
      docs/en/framework/ui/angular/theming.md

42
docs/en/framework/ui/angular/theming.md

@ -105,12 +105,14 @@ The [Application Startup Template](../../../solution-templates/application-modul
```ts ```ts
import { RoutesService, eLayoutType } from '@abp/ng.core'; import { RoutesService, eLayoutType } from '@abp/ng.core';
import { Component } from '@angular/core'; import { Component, inject } from '@angular/core';
@Component(/* component metadata */) @Component(/* component metadata */)
export class AppComponent { export class AppComponent {
constructor(routes: RoutesService) { private routes = inject(RoutesService);
routes.add([
constructor() {
this.routes.add([
{ {
path: '/your-path', path: '/your-path',
name: 'Your navigation', name: 'Your navigation',
@ -141,7 +143,7 @@ See the [Modifying the Menu](modifying-the-menu.md) document to learn more about
````ts ````ts
import { NavItemsService } from '@abp/ng.theme.shared'; import { NavItemsService } from '@abp/ng.theme.shared';
import { Component } from '@angular/core'; import { Component, inject } from '@angular/core';
@Component({ @Component({
template: ` template: `
@ -153,8 +155,10 @@ export class MySearchInputComponent {}
@Component(/* component metadata */) @Component(/* component metadata */)
export class AppComponent { export class AppComponent {
constructor(private navItems: NavItemsService) { private navItems = inject(NavItemsService);
navItems.addItems([
constructor() {
this.navItems.addItems([
{ {
id: 'MySearchInput', id: 'MySearchInput',
order: 1, order: 1,
@ -184,24 +188,25 @@ Language Selection toolbar item is generally a dropdown that is used to switch b
**Example: Get the currently selected language** **Example: Get the currently selected language**
````ts ````ts
import {SessionStateService} from '@abp/ng.core'; import { SessionStateService } from '@abp/ng.core';
import { inject } from '@angular/core';
//... //...
constructor(private sessionState: SessionStateService) { const sessionState = inject(SessionStateService);
const lang = this.sessionState.getLanguage() const lang = sessionState.getLanguage();
}
```` ````
**Example: Set the selected language** **Example: Set the selected language**
````ts ````ts
import {SessionStateService} from '@abp/ng.core'; import { SessionStateService } from '@abp/ng.core';
import { inject } from '@angular/core';
//... //...
constructor(private sessionState: SessionStateService) { const sessionState = inject(SessionStateService);
const lang = this.sessionState.setLanguage('en') sessionState.setLanguage('en');
} }
```` ````
@ -219,7 +224,7 @@ All of the options are shown below. You can choose either of them.
````ts ````ts
import { eUserMenuItems } from '@abp/ng.theme.basic'; import { eUserMenuItems } from '@abp/ng.theme.basic';
import { UserMenuService } from '@abp/ng.theme.shared'; import { UserMenuService } from '@abp/ng.theme.shared';
import { Component } from '@angular/core'; import { Component, inject, Inject } from '@angular/core';
import { Router } from '@angular/router'; import { Router } from '@angular/router';
// make sure that you import this component in a NgModule // make sure that you import this component in a NgModule
@ -239,15 +244,18 @@ export class UserMenuItemComponent {
@Component({/* component metadata */}) @Component({/* component metadata */})
export class AppComponent { export class AppComponent {
constructor(private userMenu: UserMenuService, private router: Router) { private userMenu = inject(UserMenuService);
private router = inject(Router);
constructor() {
this.userMenu.addItems([ this.userMenu.addItems([
{ {
id: 'UserMenu.MyAccount', id: 'UserMenu.MyAccount',
order: 1, order: 1,
// HTML example // HTML example
html: `<a class="dropdown-item pointer">My account</a>`, html: `<a class="dropdown-item pointer">My account</a>`,
// text template example // text template example
textTemplate: { textTemplate: {
text: 'AbpAccount::MyAccount', text: 'AbpAccount::MyAccount',

Loading…
Cancel
Save