Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/mysql/63.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Mysql 使用数据库中的动态数据绑定Angular_Mysql_Asp.net Mvc_Angularjs_Model View Controller - Fatal编程技术网

Mysql 使用数据库中的动态数据绑定Angular

Mysql 使用数据库中的动态数据绑定Angular,mysql,asp.net-mvc,angularjs,model-view-controller,Mysql,Asp.net Mvc,Angularjs,Model View Controller,我对Angularjs非常陌生,我希望实现一个类似于此jsfiddelhttp://jsfiddle.net/NfPcH/93/(从官方angular文档中检索)但是,如何用从MVC或ViewBag中的数据库检索的数据列表来填充表格,而不是硬编码数据 例如,与下面的MVC表格不同,我希望实现相同的功能,但使用Angular使表格可编辑 @if (ViewBag.Session != null) { <table class="table table-hover"> <

我对Angularjs非常陌生,我希望实现一个类似于此jsfiddel
http://jsfiddle.net/NfPcH/93/
(从官方angular文档中检索)但是,如何用从MVC或ViewBag中的数据库检索的数据列表来填充表格,而不是硬编码数据

例如,与下面的MVC表格不同,我希望实现相同的功能,但使用Angular使表格可编辑

@if (ViewBag.Session != null)
{
<table class="table table-hover">
     <tr>
        <th>
            ID
        </th>
        <th>
            Name
        </th>
        <th>
            Surname
        </th>
        <th>
            House
        </th>
        <th>
            Address
        </th>
        <th>
            Locality
        </th>
        <th>
            Contact
        </th>
        <th>
            Contact 2
        </th>
        <th>
            Contact 3
        </th>
        <th>
            Reply
        </th>
        <th>
            Edit
        </th>
    </tr>
    @foreach (var item in ViewBag.Session)
    {
    <tr>
        <td>
            @item.ID
        </td>
        <td>
            @item.Name
        </td>
        <td>
            @item.Surname
        </td>
        <td>
            @item.House
        </td>
        <td>
            @item.Address
        </td>
        <td>
            @item.Locality
        </td>
        <td>
            @item.Contact1
        </td>
        <td>
            @item.Contact2
        </td>
        <td>
            @item.Contact3
        </td>
        <td>
            @item.Reply
        </td>
    </tr>
    }
</table>
@if(ViewBag.Session!=null)
{
身份证件
名称
姓
房子
地址
地点
接触
联系人2
联系人3
回复
编辑
@foreach(ViewBag.Session中的变量项)
{
@item.ID
@项目名称
@项目.姓氏
@项目.房屋
@项目.地址
@项目.地点
@项目1.1
@项目1.2
@项目1.3
@项目.答复
}

此外,在更改和保存行时,如何将数据发送回备份行以保存在数据库中?

我认为您最好阅读jumpstart教程、培训或书籍

这里有一个链接,可以在服务器端使用WebAPI,在客户端使用angularjs,它只是从服务器加载一个项目列表


AngularJS有一种与ASP.NET MVC截然不同的方法。请尝试先了解AngularJS