Angular.js and ASP.NET MVC 4



  • 3 Answer(s)

    Preamble -This is 3rd non trivial front end built with a MVVM/MVC lib.

      Start the work with knockout because its MVVM is very similar to the wpf/silverlight mechanics and it works well. The tutorials and documentation are top notch. All the coders will be able to work with knockout.js within days or if they have used mvvm under .net, then within hours.

           However, these days  using angular and will probably stick with it for the following reasons.

    •   Angular is a perfect framework – knockout is really about just the 2 way binding. It need other libraries like backbone.js/jquery to do the rest of your work.
    •   Angular has dependency injection. which is perfect for adding
      mocking for testing as well as giving structure to the code.
    •   Angular treats normal JS variables as observables within its $scope object. that means  do not have to declare them in a special way.

             It moves to to the MVVM architecture instead of the “funkyMVVM/MVC hybrid architecture.

            Compared to knockout,  It will takes additional time and cost to getting the coders up to speed. 

             So it is currently the best choice IMHO.

    Answered on November 15, 2018.
    Add Comment

      Eventhough , Angular has a steep learning curve but its good because of the power of directives.

      It need two-way model data binding – On occassion  it need to set some initial values coming from the MVC controller. Use the ng-init attribute to accomplish this.

    For the ability to test views – The AngularJS docs for testing is good for some.

      “Save Changes” functionality –  Implement this using a directive in Angular.

      “Notifications” functionality – Implemented this using toastr.js and directives (schweet)

      For  “future proof” the application –  Google’s plans is not known for AngularJS, but after working with AngularJS and expected it to become more widely adopted.

    Answered on November 15, 2018.
    Add Comment

      Knockout is primarily a data-binding library to connect views to view model, but doesn’t give a lot of capabilities beyond that. Do not recommend using knockout alone as the main library to build a complex client-based web site.

       For implementing spa-like functionality or whether you’re primarily is not mention using MVC server-side views (e.g. Razor). If you’re just looking for quick data-binding on a per-page level, then think that. both of these are designed to enhance the client-side development experience – not so much a server-side approach such as MVC.

        Considering an SPA approach, even in part, It want some framework that provides some level of control over the view activation life cycle.

       As far as data-binding power and reliability,  Knockout is good.  using it extensively, and have grown quite fond of it. If  feel of knockout,  look into Durandal. Durandal is a decent framework is able to meet the needs of many “spa” web projects. It’s a client-side framework built on top of several proven libraries, including Knockout. It’s a little more light-weight than Angular, and possibly easier to user.

        Build a fairly large ASP.Net MVC web site using Durandal with Knockout in conjunction with an additional facade to tighten things up from a development standpoint, and the integration with ASP.Net MVC is straight-forward.Do not recommend trying to use the server-side knockout stuff that’s out there;  Limit the real power of the MVVM pattern.

    Answered on November 15, 2018.
    Add Comment


  • Your Answer

    By posting your answer, you agree to the privacy policy and terms of service.