-
Notifications
You must be signed in to change notification settings - Fork 12k
Unable to use the object with key value 'templateUrl' in angular6 #12488
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
Comments
This seems like a bug but we'll need to look at a reproduction to find and fix the problem. Can you setup a minimal repro please? You can read here why this is needed. A good way to make a minimal repro is to create a new app via This might be related to your directory structure so its really important to get an accurate repro to diagnose this. |
please find the attached sample here. please do npm install before ng serve |
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
…orators (angular#12503) At the moment we are processing all property assignments in object literals irrespective if they are in a decorator or not. With this change we will process only property assignments found under in a component decorator. Fixes angular#12488, Fixes angular#6007, Fixes: angular#6498 and Fixes: angular#8295
Bug Report or Feature Request (mark with an
x
)Command (mark with an
x
)Versions
"@angular-devkit/build-angular": "~0.7.0",
"@angular-devkit/build-ng-packagr": "~0.7.0",
"@angular/cli": "~6.1.5",
"@angular/compiler-cli": "^6.1.0",
"@angular/language-service": "^6.1.0",
"@types/jasmine": "~2.8.6",
"@types/jasminewd2": "~2.0.3",
"@types/node": "~8.9.4",
"codelyzer": "~4.2.1",
"jasmine-core": "~2.99.1",
"jasmine-spec-reporter": "~4.2.1",
"karma": "~1.7.1",
"karma-chrome-launcher": "~2.2.0",
"karma-coverage-istanbul-reporter": "~2.0.0",
"karma-jasmine": "~1.1.1",
"karma-jasmine-html-reporter": "^0.2.2",
"ng-packagr": "^3.0.0",
"protractor": "~5.4.0",
"ts-node": "~5.0.1",
"tsickle": ">=0.29.0",
"tslib": "^1.9.0",
"tslint": "~5.9.1",
"typescript": "~2.7.2"
Angular CLI: 1.6.6
Repro steps
I have the below object in component.ts and I am going to iterate this array in the HTML template inside ui-comp-menu.
menuObject = [{
'labels': 'Content1',
'templateUrl': 'assets/partials/sample.html',
'childrens': [],
},
{
'labels': 'Content2',
'templateUrl': 'assets/partials/sample1.html',
}];
and in the html
<ui-comp-menu [data]="menuObject" [label]="'labels'" [url]="'routeUrl'" >
But while compiling I got the below error
The log given by the failure
ERROR in ./src/app/app.component.ts
Module not found: Error: Can't resolve './assets/partials/UserAdministration.html' in 'D:\POC_Angular_6\lib-demo\src\appI
Desired functionality
It should work even if you give an object with 'templateUrl' as key name
Mention any other details that might be useful
If i change the object key 'templateUrl' to some other name like 'templatePath' issue won't come and compiled successfully.
Similarly 'styleUrl' also not supported.
Ref. this: https://stackoverflow.com/questions/52648392/unable-to-use-the-object-with-key-value-templateurl-in-angular6/52648863#52648863
The text was updated successfully, but these errors were encountered: