以角度添加数据 [英] adding data in angular

查看:106
本文介绍了以角度添加数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我想使用angular将用户输入的数据保存到表中,假设我有一个名为Persons的表;我将如何编写一个将数据保存到数据库的函数。

所以我有这个:



Angular JS文件代码:



Hi All ,
I want to save data from a users input into a table using angular, lets say I have got a table in named Persons; how would I write a function that would save the data onto a database.
So i have got this:

Angular JS File code:

app.controller("MainController", function($scope) {

    $scope.inputfName = "";
    $scope.inputLastName = "";


    $scope.addNew = function() {

        //This is where I am stuck!

    };




});








我的HTML文件中的
我有GUI;









in my HTML file I have got the GUI;


<div id='content' ng-app='MyApp' ng-controller='MainController'>
       <label>First Name:</label>
       <input type="text" ng-model="inputfName"/> <br/>
       <label>Last Name::</label>
     &nbsp;  <input type="text" ng-model="inputLastName"/>
    &nbsp; &nbsp;  <button ng-click="addNew()">Add New</button>


   </div>







如何我添加?或者如何在角度js中创建一个sql插入语句?注意:我正在使用visual studio




How do I add? or how to create an sql insert statement in angular js?? Note: I am using visual studio

推荐答案

scope){


scope.inputfName = ;
scope.inputfName = "";


scope.inputLastName = ;
scope.inputLastName = "";


这篇关于以角度添加数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆