Search Posts

Category: razor

Angularjs fails with passing data from ASP.Net Razor view

Recently I had a situation, when the user typed in input textbox something like “{{ text :}}” and saved it. And this caused the Angular fail on some pages. So, if I pass data to my controller from Razor view like this @{ var test = “{{ test :}}”; } <html> <head> </head> <body ng-app=”TestApp” ng-controller=”TestCtrl” ng-init=”test = ‘@test’;”> </body> </html> I get following error https://docs.angularjs.org/error/$parse/syntax?p0=:&p1=is%20an%20unexpected%20token&p2=6&p3=test%20:&p4=: Syntax Error: Token ‘:’ is an unexpected token at […]

How can Asp Net Core serve html static pages?

I start recently an Asp .Net Core app. Later i want to integrating it with Angular, but first i want a mechanism that will ‘replace’ cshtml with html. If i change extension from cshtml to html i get this ‘InvalidOperationException: The view ‘Index’ was not found’. Also i tried in Startup app.UseStaticFiles(); app.UseMvc(routes => { routes.MapRoute( name: “default”, template: “{controller=Home}/{action=Index}/{id?}”); }); but also didn’t work. Optional is to integrating cshtml layout content with html pages, […]