将Viewbag数据绑定到Angular JS

时间:2016-06-15 10:04:42

标签: angularjs asp.net-mvc

我的控制器中有一个List,它是Student类型(模型中的类)

<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet" />

<form class="form-horizontal" id="orderForm">
  <div class="form-group">
    <label for="" class="col-sm-4 control-label">Lorem</label>
    <div class="col-sm-6">
      <select name="" id="" class="form-control required">
        <option value=""></option>
        <option value="lorem">lorem</option>
        <option value="ipsun">ipsun</option>
      </select>
    </div>
  </div>
  <input class="btn btn-info" type="submit" value="Submit" />
</form>

我正在使用Angular JS (初级到Angular JS)

public class DefaultController : Controller
    {
        // GET: Default
        public ActionResult Index()
        {
            List<Student> obj = new List<Student>() {
                new Student() { ID=1,Name="titi",Address="bbsr"},
                new Student() { ID=1,Name="titi1",Address="bbsr"},
                new Student() { ID=1,Name="titi2",Address="bbsr"}
            };

            ViewBag.data = obj;
            return View();
        }
    }

未按预期获得输出..其中&amp;我错过了什么,我尝试了所有试用

0 个答案:

没有答案