0

Presently, I can use only html template in angular cli component.

import { Component } from '@angular/core';

@Component({
  selector: 'app-root',
  templateUrl: './app.component.html',
  styleUrls: ['./app.component.css']
})
export class AppComponent {
  title = 'app';
}

I am using angular CLI in ASP.NET core MVC application. Can I use views from from MVC application as template to the angular template like below:

templateUrl: './Template/Index',

Currently it seems it doesn't work as the time of building angular app it is not able to resolve the template. Because it doesn't exist.

I am just exploring if it is possible.

Nps
  • 1,638
  • 4
  • 20
  • 40
  • You likely can build it with JIT and ` --no-aot` flag. You can't do that with AOT since these 2 things are mutually exclusive. – Estus Flask Jul 23 '17 at 17:34
  • I faced the same issue. I ended up using the index.html page instead and replacing the razor view with a Web API endpoint. Then I fetched the data when initializing the app. See my answer here for an example: https://stackoverflow.com/a/48027957/64279 – adam0101 Dec 29 '17 at 20:19

0 Answers0