The last to do the route part of the hero, there is a URL problem, this time I follow the tutorial inside the vs2015 integrated way to find styleurls: ['./app/app.component.css '] This time can not find, to replace styleurls: [' App.component.css '] .... Are you kidding me? Maybe it's because the file location of ' My-app ' has changed.
This does not matter, this time mainly writes the IFRAME question.
Vs inside built such a homepage
<div> <div> @Html. Partial ("_leftlayout") </div> <div> <div > @Html. Partial ("_righttoplayout") </div> <div > <iframe id= "Ifrcontent" Frameborder= "0" scrolling= "Auto" src= "/home/welcome" ></iframe> </div> </div></ Div>
Then My-app element in the Welcome page inside, run, en, page out, but ... F12 one vote red.
But the page is out.
Put the My-app in the IFRAME peer, no matter what the same
<my-app>Loading...</my-app> <iframe id= "ifrcontent" frameborder= "0" scrolling= "Auto" src= "/Home /welcome "></iframe>
The problem remains
When the IFRAME removed after the problem solved .... But that's not what I want!
I just want to show the contents of My-app in the IFRAME, but I don't know how to solve it.
The second pit is ANGULAR2 Routing and MVC routing problem, the tutorial also said there will be such a problem, can not write how to solve.
I saw a microblog that was integrated with ANGULAR2 and net core and used
Routes. Mapspafallbackroute ("Spa-fallback", new {controller = "Home", action = "Index"});
This I checked is the core inside only, in the Assembly Microsoft.AspNetCore.SpaServices inside.
Turn over the source code is added a route, I like this son wrote a. (Inside the core is the iroutebuilder extension, I wrote it in RouteCollection, it looks like a cat!) )
And I ran a bit really solved the routing problem, however. Resolved only once. Really only once, only I no matter how to run the modified code, this route is not working,
Address bar access to http://localhost:13971/heroes, or http://localhost:13971/dashboard will be directly 404, I am also a black question mark.
If you put this route in front of the MVC default route, there will be more than 2, that's for sure, so I won't write it.
How to solve this, he really succeeded once!
Angular2 using IFRAME and front-end routing pits not resolved