angularjs对象不是函数错误

编码器

我正在尝试将转发器数组项作为参数发送到Web api控制器方法。当我单击包含函数的按钮时,它在控制台中给了我这个错误,什么也没有发生。

object is not a function

我想我以错误的方式传递了orders数组。如何正确做到这一点。

我的重复

    <table class="table table-bordered table-hover" style="width:800px" data-ng-model="orderProduct">
            <tr data-ng-repeat="order in orders">
                <td>{{selectedProduct.pname}}</td>
                <td>{{order.pid}}</td>
                <td>{{order.oid}}</td>
                <td>{{order.qty}}</td>
                <td>{{order.total}}</td>
            </tr>
        </table>
        <input type="button" data-ng-click="addOrder()" class="btn btn-danger" data-ng-disabled="!orders.length" value="Submit Orders" />

我的控制器方法$ scope

    $scope.addOrder = function () {
            var orders = this.orders;
            $http.post('/api/OrderDetails/', orders).success(function (data) {
                alert("Added Successfully!!");
                $scope.addMode = false;

            }).error(function (data) {
                $scope.error = "An Error has occured while Adding Order details! " + data;

            });
        };
贾亚

我从您的小插曲中发现的是-表单名和控制器的方法名不能相同。我将表单名称从addOrder更改addOrderForm。名称更改后,即可正常工作。请在此处查看工作的朋克:http ://plnkr.co/edit/CfaNY9z5vVMi5uqh5v7k? p= preview

PS:我已经自由添加了一些json和angular代码来使表单起作用。

本文收集自互联网,转载请注明来源。

如有侵权,请联系[email protected] 删除。

编辑于
0

我来说两句

0条评论
登录后参与评论

相关文章

来自分类Dev

箭头函数错误:对象不是函数

来自分类Dev

在我的情况下,AngularJS undefined不是函数错误

来自分类Dev

控制器不是AngularJS 1.5.7的函数错误

来自分类Dev

addEventListener不是函数错误

来自分类Dev

.autocomplete不是函数错误

来自分类Dev

.autocomplete不是函数错误

来自分类Dev

“调度”不是函数错误

来自分类Dev

.filter 不是函数错误?

来自分类Dev

getFeaturesByAttribute 不是函数错误

来自分类Dev

获取类型错误:* 不是函数错误

来自分类Dev

服务中的AngularJS函数在路由更改后抛出“不是函数错误”?

来自分类Dev

TypeError:$(...)。dialog不是函数错误

来自分类Dev

sequelize .create不是函数错误

来自分类Dev

React DND,connectDragSource不是函数错误

来自分类Dev

“ setOwner”不是函数错误-App脚本

来自分类Dev

React DND,connectDragSource不是函数错误

来自分类Dev

React Native undefined不是函数错误

来自分类Dev

javascript - 单击不是函数错误

来自分类Dev

回调不是函数错误 [Nodejs]

来自分类Dev

遇到 this.state 不是函数错误

来自分类Dev

$ event.stopPropogation不是Angularjs单元测试中的函数错误

来自分类Dev

在angularJS中使用工厂方法时,未定义不是函数错误

来自分类Dev

未捕获的TypeError:fn不是AngularJS网页中的函数错误

来自分类Dev

为什么会收到“被调用对象0不是函数错误”的信息?

来自分类Dev

为什么会收到“被调用对象0不是函数错误”的信息?

来自分类Dev

引用对象内部的方法给出未定义不是函数错误

来自分类Dev

AngularJs中没有函数错误

来自分类Dev

Php 函数错误(类 PDOStatement 的对象)

来自分类Dev

函数内的承诺得到错误不是函数错误

Related 相关文章

热门标签

归档