I just want to login to the flask-rest-api in angularjs, *I don't know how 
to send the login info (username and password)to flask-rest-api.* In this 
app There is one table after successfully login and it will load the data. 
Here we are *not using any data-base* but username and password is *hard-coded 
in rest-server code*. and username="admin" and password="1234". When can 
modify, update, addNewData. I took this from this blog 
<http://blog.miguelgrinberg.com/post/designing-a-restful-api-using-flask-restful>,
 
here they are using in knockout, I am trying to in Angularjs
For more info please visit the 
http://stackoverflow.com/questions/31207250/how-to-allow-users-to-login-protected-flask-rest-api-in-angularjs
   



*AngulurJS code*

<script>

                    var app = angular.module('myApp', []);
                    app.controller('tasksCtrl', function($scope, $http) {
                        $scope.submitData=function(username, password){
                            var config={
                               params:{
                                   username:username, password:password
                               }
                            };
                        };
                        //$http.get("data.json")
                        $http.get("/todo/api/v1.0/tasks")
                        .success(function(response) {
                            console.log(response.tasks)
                            $scope.tasks = response.tasks;
                        });

                        $scope.editTask = function(task) {
                            $scope.selectedTask = task;
                        };
                        $scope.removeRow = function(task) {
                            $scope.tasks.splice(task, 1);
                        };
                        $scope.addNewTask = function() {
                            //$scope.tasks.push({title 
:$scope.task1,description: $scope.description1});
                            $scope.tasks.push({title: $scope.task1, 
description: $scope.description1});
                            $scope.task1 = '';
                            $scope.description1 = '';
                            //   $scope.tasks.push('dhsh');
                        };
                    });    
        </script>


-- 
You received this message because you are subscribed to the Google Groups 
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to