Skip to content

Need documentation for Custom Module #3973

Closed

Description

@Ploppy3

According to the changelog of Beta 3 it is recommended to create our own Material module to reduce app size.

But I can't find any documentation on how to create my own Material module.

Activity

  1. fxck commented on Apr 8, 2017

    @fxck
    Contributor
  2. Ploppy3 commented on Apr 8, 2017

    @Ploppy3
    Author

    I know how to create an Angular module. What I don't know is what we are supposed to import from @angular/material, do you ?

  3. fxck commented on Apr 8, 2017

    @fxck
    Contributor

    You are supposed to import whatever modules you are using in your app, ie. MdButtonModule. Either way, this is neither a bug report or feature request, support requests are better suited for gitter or stackoverflow.

  4. Ploppy3 commented on Apr 8, 2017

    @Ploppy3
    Author

    This is what I do:

    import { MdButtonModule } from "@angular/material";
    
    @NgModule({
      imports: [
        MdButtonModule
      ],
    })
    export class MyMaterialModule { }
    

    And in my app.module.ts I import MyMaterialModule and everything breaks.
    Am I missing something obvious ?

  5. fxck commented on Apr 8, 2017

    @fxck
    Contributor

    Are you sure you "know how to create an angular module" or that you actually read the guide I pointed you to? This section in particular https://angular.io/docs/ts/latest/guide/ngmodule.html#!#shared-module ?

  6. Ploppy3 commented on Apr 8, 2017

    @Ploppy3
    Author

    Why not point out my mistake? Imports instead of Exports...

    That doesn't change the fact that the documentation is missing.

  7. mackelito commented on Apr 8, 2017

    @mackelito

    All working! All Good!
    Stay safe, happy and helpful!

  8. jelbourn commented on Apr 9, 2017

    @jelbourn
    Contributor

    Updated the getting started guide with an example.

  9. candidosales commented on Apr 9, 2017

    @candidosales
    import { NgModule }      from '@angular/core';
    import {
      MdButtonModule,
      MdSnackBarModule,
      MdCardModule,
      MdInputModule,
      MdCheckboxModule,
      MdIconModule,
      MdSidenavModule,
      MdSelectModule,
      MdToolbarModule,
      MdListModule,
      MdProgressBarModule,
      MdProgressSpinnerModule } from '@angular/material';
    import 'hammerjs';
    
    
    @NgModule({
        imports: [
          MdButtonModule,
          MdSnackBarModule,
          MdCardModule,
          MdInputModule,
          MdCheckboxModule,
          MdIconModule,
          MdSidenavModule,
          MdSelectModule,
          MdToolbarModule,
          MdListModule,
          MdProgressBarModule,
          MdProgressSpinnerModule ],
        exports: [
          MdButtonModule,
          MdSnackBarModule,
          MdCardModule,
          MdInputModule,
          MdCheckboxModule,
          MdIconModule,
          MdSidenavModule,
          MdSelectModule,
          MdToolbarModule,
          MdListModule,
          MdProgressBarModule,
          MdProgressSpinnerModule ]
    })
    export class CustomMaterialModule {  }

    My example :)

  10. attilacsanyi commented on Apr 10, 2017

    @attilacsanyi

    AFAIK @candidosales the imports section in your CustomMaterialModule is not necessary needed as CustomMaterialModule is just for exporting required material components for your app and help to reduce your bundle during AOT ;-)

  11. alexfung888 commented on Apr 29, 2017

    @alexfung888

    It is a bit annoying to repeat the list of modules in the ES5 import and the export annotation.

    Does it make any difference to import hammer here? Seems I'll need to import hammer in appmodule again, since I can't export it from here.

  12. angular-automatic-lock-bot commented on Sep 5, 2019

    @angular-automatic-lock-bot

    This issue has been automatically locked due to inactivity.
    Please file a new issue if you are encountering a similar or related problem.

    Read more about our automatic conversation locking policy.

    This action has been performed automatically by a bot.

  13. locked and limited conversation to collaborators on Sep 5, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions