Click here to Skip to main content
15,911,531 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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:

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

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


    $scope.addNew = function() {

        //This is where I am stuck!

    };




});




in my HTML file I have got the GUI;


XML
<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>



How do I add? or how to create an sql insert statement in angular js?? Note: I am using visual studio
Posted
Comments
Stephen Hewison 30-Jul-14 4:44am    
What database are you trying to write to? WebDB, IndexedDB (These are client side databases) or are you looking to write the data server side? So MSSQL?
1Future 30-Jul-14 5:04am    
Sorry yeah, data server side so yes MSSQL

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900