Angular2TypeScriptASPNETCoreWebApp icon indicating copy to clipboard operation
Angular2TypeScriptASPNETCoreWebApp copied to clipboard

Cannot use templateUrl parameter in component

Open bradlymathews opened this issue 8 years ago • 11 comments
trafficstars

As far as I can tell, there is something wrong with the build environment in the project that prevents templateUrl from working. The component's html file is not found (404). See this SO post for more details.

bradlymathews avatar May 25 '17 23:05 bradlymathews

Sorry for the delay, I'm kind of busy these days. I'll check this ASAP. Thank's for reporting.

AdrienTorris avatar Jun 07 '17 06:06 AdrienTorris

I've juste quickly look at it and I don't understand your issue. I've add a new component with an HTML file and it's working. You can see a templateUrl working in the AboutComponent, the view is here.

Can you give me more details about the issue you are dealing with ?

AdrienTorris avatar Jun 07 '17 06:06 AdrienTorris

https://github.com/AdrienTorris/Angular2TypeScriptASPNETCoreWebApp/commit/014ae1428f9f5e9a045e5028b6968286e526f329

AdrienTorris avatar Jun 07 '17 06:06 AdrienTorris

I post an answer on Stack Overflow. I think you forgot to declare your new component in the application module. Can you keep me updated ? Sorry for the delay again ...

AdrienTorris avatar Jun 07 '17 06:06 AdrienTorris

I have a sample error and i already wrote it on AppModule and Routing

IsoraTatsu avatar Jul 17 '17 06:07 IsoraTatsu

I get the same problem. Part of my component is below @Component({ selector: 'app-server', // template: '

The server component for me

' templateUrl: './server.component.html' }) The above does not work but when I comment out the templateUrl line and remove the in line template comments, the code works and the HTML is displayed. The app.module.ts is set up correctly. The in line template would not work otherwise.

CMode11 avatar Jul 24 '17 16:07 CMode11

@CMode11 Is your project visible somewhere ? On GitHub ?

AdrienTorris avatar Jul 25 '17 06:07 AdrienTorris

@CMode11 Note that the templateUrl is refering to the build directory (outDir parameter in your tsconfig file), so your html file has to be there

AdrienTorris avatar Jul 25 '17 06:07 AdrienTorris

Hi Adrien, I just posted my project to https://github.com/CMode11/ang4VS Still cant solve problem. Hope you can find it. Im sure its something simple. I just wanted a simple component with templateUrl accessing a html file

CMode11 avatar Jul 25 '17 15:07 CMode11

Windows crashed twice during your zip's extraction. I can't see the file in there.

AdrienTorris avatar Jul 25 '17 15:07 AdrienTorris

@CMode11 If you put your projet on the GitHub source control in a classic way (without a zip but with the files directly in GitHub), I could take a look if you want.

AdrienTorris avatar Jul 26 '17 07:07 AdrienTorris