I am currently in the process of migrating an Angular 1.5 project to Angular 6, but I've encountered an issue with the templateUrl not working in the Angular 1.5 component. The packages I am using are:
Angular CLI 6.0.8 TypeScript 2.7.2 Angular 6.0.7
The Angular 1.5 components have the templateUrl mapped, and I have managed to build a hybrid app where both Angular 1 and Angular 6 components are rendered. However, upon loading the project, the templateUrl path returns a 404 not found error, causing the AngularJS 1.5 component not to render. If I use 'template' with inline HTML strings, it works fine.
My Angular 1.5 code is written in JavaScript, while I'm using TypeScript for my Angular 6 code.
If anyone has any insights on this issue, I would greatly appreciate it as I have been stuck on this problem for the past few days.
Thanks!
EDIT
angular.
module('app.users').
component('userDetails', {
templateUrl : './ng1/app/src/users/user-details.html',
//template: 'This is user detail',
controller: UserController
});
Using 'template' works correctly, but when using templateUrl, it does not. I have tried various links such as:
./ng1/app/src/users/user-details.html
./app/src/users/user-details.html
../user-details.html
./users/user-details.html
Although my component JS file is located under ./ng1/app/src/users, during the build process using Gulp, the bundle JS is created at the root folder.
EDIT
The error message I am receiving is as follows:
zone.js:2969 GET http://localhost:8082/ng1/app/src/users/user-details.html 404 (Not Found)
angular.js:13236 Error: [$compile:tpload] Failed to load template: ./ng1/app/src/users/user-details.html (HTTP status: 404 Not Found)
EDIT Browser URL: http://localhost:8082/users
The route is specified as
$routeProvider.when('/users', {
template: '<user-details></user-details>'
})