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

TemplateUrl not working #13

Open
ovaismehboob opened this issue Nov 19, 2016 · 1 comment
Open

TemplateUrl not working #13

ovaismehboob opened this issue Nov 19, 2016 · 1 comment

Comments

@ovaismehboob
Copy link

Hi,

I am using ASP.NET Core + Angular 2 template. The problem is with the TemplateURL which is not working with any URL. In my scenario I want to route it to the MVC controller and wanted to load the about page of Home controller.

Below is the exception.
Exception: Call to Node module failed with error: Error: No ResourceLoader implementation has been provided. Can't read the url "Home/About"

Here is my sample about.component.ts

import {Component} from '@angular/core';
import { platformUniversalDynamic } from 'angular2-universal';
@component({
selector: 'about',
templateUrl: 'Home/About'
})

export class AboutComponent {
message: string = 'Hello World';

Side notes:

  1. I have also added the "angular2-template-loader" as dev dependency in package.json.
  2. Here is my module configuration in webpack.json

module: {
loaders: [
{
test: /.ts$/,
loaders: ['awesome-typescript-loader', 'angular2-template-loader?keepUrl=true'],
exclude: [/.(spec|e2e).ts$/]
},
/* Embed files. /
{
test: /.(html|css)$/,
loader: 'raw-loader',
exclude: /.async.(html|css)$/
},
/
Async loading. */
{
test: /.async.(html|css)$/,
loaders: ['file?name=[name].[hash].[ext]', 'extract']
}
]
}

@peterdobson
Copy link

peterdobson commented Jan 4, 2017

have you tried replacing :

templateUrl: 'YourPath'

with

template: require('../YourPath')

?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants