Skip to content

Missing template .html file for node_modules dependency #3274

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

Closed
magemello opened this issue Nov 24, 2016 · 4 comments
Closed

Missing template .html file for node_modules dependency #3274

magemello opened this issue Nov 24, 2016 · 4 comments
Labels
P5 The team acknowledges the request but does not plan to address it, it remains open for discussion type: bug/fix

Comments

@magemello
Copy link

magemello commented Nov 24, 2016

Hi guys,

I'm having some issues with the template, not sure is related to the way how angular-cli load the dependency.

Architecture:

  • Angular 2 app generated with angular-cli
  • Angular 2 Component linked with npm int the generated app (test-component).

Description:

The generated Angular 2 app throw me the following error when I try to use the linked Angular 2 component :

VM32836:388 Unhandled Promise rejection: Failed to load test.component.html ; Zone: <root> ; Task: Promise.then ; Value: Failed to load test.component.html

.ts of the linked component

@Component({
    selector: 'test-component',
    templateUrl: './test.component.html',
    styleUrls: ['./test.component.css']
})
export class TestComponent  { }

If I change the code in the following way it works:

@Component({
    selector: 'test-component',
    template: require('./test.component.html'),
    styles: [require('./test.component.css')]
})
export class TestComponent  { }

But I can't use the require and I would like to fix the problem without introducing this change.

OS

Mac OSX

Versions.

angular-cli: 1.0.0-beta.20-4
node: 6.2.2
os: darwin x64

@filipesilva
Copy link
Contributor

This seems to be an odd interaction with symlinks. Your usage is kind of peculiar though, I don't expect that to be a common case.

@filipesilva filipesilva added command: build P5 The team acknowledges the request but does not plan to address it, it remains open for discussion type: bug/fix labels Dec 29, 2016
@serhiisol
Copy link
Contributor

@filipesilva I have similar problem with latest cli.

I have ng-components package which has a lot of different components, e.g.:

import { Component, Input } from '@angular/core';

@Component({
  selector: 'otto-tooltip',
  templateUrl: 'tooltip.component.html',
  styleUrls: ['tooltip.component.sass']
})
export class TooltipComponent {
  @Input() title: string;
  @Input() show: boolean = false;
}

I import it from node_modules like: import {TooltipComponent} from 'ng-components/tooltip';

Angular cli 21 used ````angular2-template-loader``` to replace template url and style urls to template with require.

So at this point it seems like it's impossible to write 3rd party components for reusability with latest cli, of course If they won't have inline html and css, which is quite ugly.

@filipesilva
Copy link
Contributor

Dupe of #1624

@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 6, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
P5 The team acknowledges the request but does not plan to address it, it remains open for discussion type: bug/fix
Projects
None yet
Development

No branches or pull requests

3 participants