c# - Angular 1.5 routing(ngRoute) refresh/reload issue in MVC 5 -
i've been going through lot of posts routing mvc/angular how use still not able make work. have problem page refresh/reload when being on angular view/route, it's wont work.
here got far:
anguar route provider - routes components:
$routeprovider .when('/angular/test1', { template: '<sample-component1></sample-component1>' }) .when('/angular/test2', { template: '<sample-component2></sample-component2>' }); $locationprovider.html5mode(true);
mvc web config:
<rewrite> <rules> <rule name="angularjs" stopprocessing="true"> <match url=".*" /> <conditions logicalgrouping="matchall"> <add input="{request_filename}" matchtype="isfile" negate="true" /> <add input="{request_uri}" matchtype="pattern" pattern="^(?!.*angular/).*$" negate="true" /> </conditions> <action type="rewrite" url="/" /> </rule> </rules> </rewrite>
my mvc routes configuration:
routes.maproute( name: "angular", url: "angular/{*catch-all}", defaults: new { controller = "home", action = "angular" } ); routes.maproute( name: "default", url:"{controller}/{action}/{id}", defaults:new { controller = "home", action = "index", id = urlparameter.optional });
currently when refresh page i'm getting redirected default route, additionally layout messed though references seems in place...
what's issue?
i guess allowing files angular
folder only. i'd change condition fix issue.
<conditions logicalgrouping="matchall"> <add input="{request_filename}" matchtype="isfile" negate="true" /> <add input="{request_filename}" matchtype="isdirectory" negate="true" /> </conditions>
Comments
Post a Comment