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

Angular-Material2 doesn't work with ngUpgrade #1571

Closed
DAB0mB opened this issue Oct 23, 2016 · 7 comments
Closed

Angular-Material2 doesn't work with ngUpgrade #1571

DAB0mB opened this issue Oct 23, 2016 · 7 comments

Comments

@DAB0mB
Copy link
Contributor

DAB0mB commented Oct 23, 2016

Angular-Material2 doesn't work with ngUpgrade

Hello fellows, I've been recently working on a project I'm contributed to, you can find it here. The last part of this tutorial involves migration from Angular1 to Angular2, which requires me to use the UpgradeAdapter provided by ngUpgrade. Unfortunately, once importing the modules provided by Angular-Material2 and bootstrapping the app I receive the following error:

Template parse error: ‘md-input’ is not a known element

For me it seems like a compatibility issue since I'm also contributed to a similar project but purely based on Angular2 and I don't receive the error mentioned above. You can find it here. I tried to look for similar issues but non of them involves the usage of ngUpgrade. Hopefully I didn't do anything wrong, your'e more than welcome to take a look at the project, any help would be appreciated :-)

@DAB0mB
Copy link
Contributor Author

DAB0mB commented Oct 23, 2016

To prevent some misunderstanding, here is a piece of code of which I used to load Material components:

import { MdButtonModule } from '@angular2-material/button';
import { MdInputModule } from '@angular2-material/input';
import { MdCheckboxModule } from '@angular2-material/checkbox';

// Some lines skipped...

@NgModule({
  declarations: [
    DisplayNamePipe,
    UninvitedPipe,
    PartyDetails,
    PartyUninvited
  ],
  imports: [
    BrowserModule,
    FormsModule,
    MdButtonModule.forRoot(),
    MdInputModule.forRoot(),
    MdCheckboxModule.forRoot()
  ]
})
class AppNg2Module {}

const adapter = new UpgradeAdapter(AppNg2Module);

// Some lines skipped...

function onReady() {
  adapter.bootstrap(document, [SociallyNg1Module.name]);
}

@fxck
Copy link
Contributor

fxck commented Oct 23, 2016

You are using an outdated version of material2, might want to try with the latest version.

https://github.com/angular/material2/blob/master/CHANGELOG.md#breaking-changes

@DAB0mB
Copy link
Contributor Author

DAB0mB commented Oct 23, 2016

@fxck Unfortunately I encountered a second issue thanks to that update. Apparently there is an unregistered peer dependency of @angular/http so I will keep receiving the error

Can't find module `@angular/http`

Unless manually installed. Any more suggestions?

@fxck
Copy link
Contributor

fxck commented Oct 23, 2016

https://github.com/angular/material2/blob/master/package.json#L30

try clearing your node_modules and doing a fresh npm install

@DAB0mB
Copy link
Contributor Author

DAB0mB commented Oct 23, 2016

@fxck Nope. Double checked it. If I add it as a peer dependency it is fixed. I opened a separate issue on this topic #1574.

@jelbourn
Copy link
Member

jelbourn commented Nov 4, 2016

Fixed in #1579, will be part of the next release.

@jelbourn jelbourn closed this as completed Nov 4, 2016
@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

No branches or pull requests

3 participants