Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: LY_THEME undefined #67

Closed
josnar opened this issue Dec 5, 2018 · 7 comments
Closed

Error: LY_THEME undefined #67

josnar opened this issue Dec 5, 2018 · 7 comments

Comments

@josnar
Copy link

josnar commented Dec 5, 2018

Bug, feature request, or proposal:

What is the expected behavior?

What is the current behavior?

What are the steps to reproduce?

Provide a reproduction in StackBlitz

StackBlitz starter: https://stackblitz.com/edit/angular-alyle-ui-starter

Which versions of Angular, AlyleUI, OS, TypeScript, browsers are affected?

Version of @alyle/ui@:

$ node_modules/.bin/ng --version
Angular CLI: ...
Node: ...
OS: ...
Angular: ...
...
...
...
@Enlcxx
Copy link
Member

Enlcxx commented Dec 5, 2018

Hi
In app.module.ts add this

import {
  LyThemeModule,
  LY_THEME
} from '@alyle/ui';

Follow the steps that are here

@josnar
Copy link
Author

josnar commented Dec 6, 2018

Hi
In app.module.ts add this

import {
  LyThemeModule,
  LY_THEME
} from '@alyle/ui';

Follow the steps that are here

i added but still not working,would it support for angular 6

@Enlcxx
Copy link
Member

Enlcxx commented Dec 6, 2018

Alyle UI has support for
Angular ^6.1.10 - 7.x.x
Typescript ^2.9.2

Angular CLI: 6.2.8
Node: 10.9.0
OS: linux x64
Angular: 6.1.10
... animations, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, router

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.8.8
@angular-devkit/build-angular     0.8.8
@angular-devkit/build-optimizer   0.8.8
@angular-devkit/build-webpack     0.8.8
@angular-devkit/core              0.8.8
@angular-devkit/schematics        0.8.8
@angular/cli                      6.2.8
@ngtools/webpack                  6.2.8
@schematics/angular               0.8.8
@schematics/update                0.8.8
rxjs                              6.2.2
typescript                        2.9.2
webpack                           4.16.4

@Enlcxx
Copy link
Member

Enlcxx commented Dec 6, 2018

What versions of Angular, Alyle UI and TypeScript are you using? Can you provide a reproduction in StackBlitz

@vaghazaryan
Copy link

Problem happened if you use cropper module in lazy loadable module.

I have a dirty fix.

image-cropper.module.ts

@NgModule({
  imports: [
    LyThemeModule.setTheme('minima-light'),
    CommonModule,
    FormsModule,
    LyResizingCroppingImageModule,
    LyButtonModule,
    LyIconModule
  ],
  providers: [
    {
      provide: LY_THEME,
      useClass: MinimaLight
    },
    {
      provide: LY_THEME_GLOBAL_VARIABLES,
      useClass: GlobalVariables
    } // global variables
  ],
  declarations: [ImageCropperComponent],
  exports: [ImageCropperComponent]
})
export class ImageCropperModule {}

core.module.ts

@NgModule({
  imports: [
    ImageCropperModule,
]
})
export class CoreModule {}

lazy.module.ts

@NgModule({
  imports: [
    ImageCropperModule,
  ]
})
export class LazyModule {}

@haovc
Copy link

haovc commented Dec 29, 2018

You just need add in core module(app.module.ts):
providers: [
{
provide: LY_THEME,
useClass: MinimaLight
},
{
provide: LY_THEME_GLOBAL_VARIABLES,
useClass: GlobalVariables
} // global variables
]

@Enlcxx
Copy link
Member

Enlcxx commented Feb 1, 2019

The themes must be added in the root module of the application, not in sub modules.

@Enlcxx Enlcxx mentioned this issue Aug 4, 2019
3 tasks
@Enlcxx Enlcxx closed this as completed Feb 9, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants