Reputation: 837
I am new to angular 2. I am using angularjs 2 with asp.net MVC and I want to use my _layout.cshtml(master page) as templateUrl in app.component.
Like in angular 1 i use ng-app="my-app" on _layout page and i can use angular on every content page. How to do that in angularjs 2
Here is my app.component.ts
import { Component } from '@angular/core';
@Component({
selector: 'my-app',
templateUrl:'/views/shared/_layout.cshtml'//i want to do that
}) export class AppComponent {
test: string = "";
}
i want to use my view(cshtml) as templateUrl and directly want to use angularjs on views
Upvotes: 0
Views: 568
Reputation: 22723
You need to this about these points when you want to use the cshtml with component
There are many other things which you need to consider
Simple solution is to convert you _layout.cshtml to index.html, because Angular is a SPA application.
I will suggest you to go to this link and try http://blog.stevensanderson.com/2016/10/04/angular2-template-for-visual-studio/
Upvotes: 0