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

Need documentation for Custom Module #3973

Closed
Ploppy3 opened this issue Apr 8, 2017 · 12 comments
Closed

Need documentation for Custom Module #3973

Ploppy3 opened this issue Apr 8, 2017 · 12 comments

Comments

@Ploppy3
Copy link

Ploppy3 commented Apr 8, 2017

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.

@fxck
Copy link
Contributor

fxck commented Apr 8, 2017

@Ploppy3
Copy link
Author

Ploppy3 commented Apr 8, 2017

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 ?

@fxck
Copy link
Contributor

fxck commented Apr 8, 2017

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.

@Ploppy3
Copy link
Author

Ploppy3 commented Apr 8, 2017

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 ?

@fxck
Copy link
Contributor

fxck commented Apr 8, 2017

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 ?

@Ploppy3
Copy link
Author

Ploppy3 commented Apr 8, 2017

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

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

@mackelito
Copy link

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

@jelbourn
Copy link
Member

jelbourn commented Apr 9, 2017

Updated the getting started guide with an example.

@jelbourn jelbourn closed this as completed Apr 9, 2017
@candidosales
Copy link

candidosales commented Apr 9, 2017

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 :)

@attilacsanyi
Copy link

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 ;-)

@alexfung888
Copy link

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.

@angular-automatic-lock-bot
Copy link

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.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 5, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants