angularjs - ASP.NET web api with angular project structure -
first time asp.net webapi + angular project. many examples i've seen online i've found there 2 ways handling views.
the first (which have seen in many tutorials , courses) - use apicontrollers only, view generated angular. means project structure have folder 'app' , contain html files (probably inside 'view' folder). routing done using angular routes. have apicontrollers in project (without regular controller object). example project: https://github.com/danwahlin/customermanagerstandard
the second - using controllers generate views, using razor (cshtml files), , angular incorporated (i.e ng-click inside cshtml). there's no special 'app' folder angular etc. example project : https://github.com/wintellect/angular-mvc-cookbook/tree/master/crudoperations
so, i'm wondering pros , cons each method, , when shall use one. examples projects great well.
i can assume first method more modular , differentiate server , client. however, using means i'm loosing razor (do need it?)
thanks!
i had make decision few months myself. comes down feel more comfortable. chose angular , webapi
controls only. makes me think in terms of true separation of concerns easier, angular presentation layer , webapi services. gives freedom compression/formatting of actual html pages(instead of cshtml pages have no control over).
one more pro webapi
scalability, need 1 webserver webpages can scale out webapi, allow webapi
api clients well.
razor
view engine , in experience angular job of templating , directives bear cost of losing razor. you'll end writing pure html in razor files anyways once hang of directives means you'll have more of issue adding new view. wants create new controller, new action , new view, , have in angular. ends being easier , less complex let server serve html files, , let angular routing , logic you.
i believe html files cached see less round trips navigate page page in angular.
Indeed. When you hire an angular JS developers, they work on a two-way data binding. This feature helps reduce the amount of code required to develop an app. Hire professional freelancers from Eiliana.com. Here you can easily find top freelancers as per your need.
ReplyDelete