GithubHelp home page GithubHelp logo

Comments (4)

HaithemMosbahi avatar HaithemMosbahi commented on May 30, 2024 2

@lorentzyip Thank you for raising this issue. I managed to reproduce it and yes it's a bug.

The thing is I just migrated the component to use Angular 6 and Angular CLI for building and packaging and it seems that there's an issue with AOT mode because when I run this ng build --prod --aot=false --build-optimizer=false it works.

I am working on this bug and I will do my best to fix it as soon as possible,

from ngx-avatar.

lorentzyip avatar lorentzyip commented on May 30, 2024 2

@HaithemMosbahi Thank you so much. 👏👏👏

from ngx-avatar.

HaithemMosbahi avatar HaithemMosbahi commented on May 30, 2024 1

Hi @lorentzyip I just released a new version 3.0.1 that contains a partial fix for the build prod issue.
Importing AvatarModule should work now, please let me now if you still have any issues.

For now the only thing that doesn't work with prod mode is AvatarModule.forRoot(avatarConfig). I'm working on it to make it AOT friendly

from ngx-avatar.

lorentzyip avatar lorentzyip commented on May 30, 2024

Let me give more information, the XXX module is a lazy-loading module which imports the AvatarModule. Here are the source codes:

app.module.ts

@NgModule({
  declarations: [
    AppComponent
  ],
  imports: [
    BrowserModule,
    AppRoutingModule
  ],
  providers: [],
  bootstrap: [AppComponent]
})
export class AppModule { }

app-routing.module.ts

const routes: Routes = [
  {
    path: '',
    redirectTo: 'xxx',
    pathMatch: 'full'
  },
  {
    path: 'xxx',
    loadChildren: './xxx/xxx.module#XxxModule'
  }
];

@NgModule({
  imports: [RouterModule.forRoot(routes)],
  exports: [RouterModule]
})
export class AppRoutingModule { }

app.component.html

<h1>Hello World</h1>

<router-outlet></router-outlet>

xxx.module.ts

@NgModule({
  imports: [
    CommonModule,
    AvatarModule,
    XxxRoutingModule
  ],
  declarations: [XxxComponent]
})
export class XxxModule { }

xxx-routing.module.ts

const routes: Routes = [
  {
    path: '',
    component: XxxComponent
  }
];

@NgModule({
  imports: [RouterModule.forChild(routes)],
  exports: [RouterModule]
})
export class XxxRoutingModule { }

xxx.component.ts inside xxx module

@Component({
  selector: 'app-xxx',
  templateUrl: './xxx.component.html',
  styleUrls: ['./xxx.component.css']
})
export class XxxComponent implements OnInit {
  constructor() { }

  ngOnInit() {
  }
}

xxx.component.html

<ngx-avatar value="HW"></ngx-avatar>

from ngx-avatar.

Related Issues (20)

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.