I followed the directions from angular.io's 5 minute quickstart and everything worked fine. I didn't have to declare .js when I used
import {Component} from 'angular2/core';
I then started using templateUrl to load in other components
import {NavMenuComponent} from '../nav/navMenu';
@Component ({
selector: 'my-app',
templateUrl: 'main.html',
directives: [NavMenuComponent]
})
export class AppComponent {}
When I run the code I get an error saying it could not find localhost:300/src/nav/navMenu
BUT if I add a .js to the end
import {NavMenuComponent} from '../nav/navMenu.js';
it works fine. I have the index.html already set to..
<script>
System.config({
packages: {
app: {
format: 'register',
defaultExtension: 'js'
}
}
});
</script>
Shouldn't that make it so I don't have to use the .js extension on imports anymore? Thanks in advance.
srcfolder forapp– Langley Jan 28 '16 at 21:37config.jsfile, theSystem.config({ packages: { app: {part you have in your code. – Langley Jan 28 '16 at 21:41System.configis specifying to use a default extension ofjson stuff under theapppackage, but for what I see, your component is undersrcnotapp:localhost:300/src/nav/navMenudoes that make sense? – Langley Jan 28 '16 at 21:58