1

I am working on a web application in ASP.NET-MVC. The task is to generate a check box list from database and put some condition on it. There are total 8 items are present in checkbox list and condition is like if second checkbox is checked then the first checkbock is checked automatically and third and fourth check box go disable. and on the selection of them the selected checkboxs values should be added automatically as total cost. I had achieved the same from using J-Query and javascript.

But one of my friend says that instead of using jquery i should go with the Angular.js this it is much lightweight and easy to use as compare to j-query.

Now i searched for angular and came to know that it is much powerfull and easy to use with html. but when i use it in MVC where the vales are coming from database i am not getting any way to use angular with my code. my code is like

@foreach (var item in Model)
{
<div class="col-md-8">
    <input type="checkbox" name="@item.serviceName" id="@item.serviceName" value="@item.cost">@item.serviceName
</div>

<div id="price-list" class="col-md-4">

    <label>@item.cost</label>

</div>
}

This is generating the checkboxes. now how should i use Angular.js with it or it is not possible to achieve the same with angular. or i have to stick with J-Query for that. Or their is any other java script framework that should i use to achieve the same.

Need your help in this. Thanks

10
  • Serialize your Model as JSON and load it to JavaScript in an AJAX call, then use Angular and avoid the Razor code. I suggest going through this tutorial first: angular.codeschool.com Commented Jun 16, 2015 at 18:52
  • Mixing strongly typed MVC views with Angular doesn't give you much and can confuse you if you're not very good with both technologies. Commented Jun 16, 2015 at 18:58
  • @Jasen So you suggest that i have to stick with the jquery. well is this possible to achieve the same with angular Commented Jun 16, 2015 at 19:01
  • @dave thank dave i think i have to go for the very first step of angular Commented Jun 16, 2015 at 19:01
  • If you have an existing site I would find it easier to use jQuery than to restructure it for Angular. Commented Jun 16, 2015 at 19:01

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.