2017-06-01 39 views
0
var app = angular.module('myApp', []); 

app.controller('SigninController', function ($scope, $http) { 

    $scope.postdata = function (email, password, deviceRegistrationId) {<br> 
    var data = {<br> 
     email: "[email protected]",<br> 
     password: "[email protected]",<br> 
     deviceRegistrationId: "dJ8foF4Fo8E:APA91bECJA4B7GivMIbdfrypr3p1TaJTGuKTsucK4TF8abVsecxNK22eqUXXh4zvqrrOziyuITqn4L4Lrr4hRPfZ4Wt9ksQ-trZecdYoxaBb3r3mX31vEgp6KfrBfs-c6I5jGuk5wZSO"<br> 
    };<br> 
    var url = "http://freedoctor.southeastasia.cloudapp.azure.com/auth/signin"<br> 
    $http.post(url, JSON.stringify(data)).<br> 
    success(function (response) {<br> 
     $scope.msg = response;<br> 
     console.log($scope.msg);<br> 
    }, <br> 
    function (response) {<br> 
     $scope.msg = "Service not Exists";<br> 
     $scope.statusval = response.status;<br> 
     $scope.statustext = response.statusText;<br> 
     $scope.headers = response.headers();<br> 
    });<br> 
    };<br> 
}); <br> 

什么是不是在这里引用,我不能找到它的ReferenceError:“x”是没有定义

+0

什么是
标签在JS做什么? – anoop

回答

1

我认为你的$范围和$ HTTP没有注入。

试试这个:

var app = angular.module('myApp', []); 



app.controller('SigninController', SigninController); 

SigninController.$inject = ['$scope','$http']; 

function SigninController($scope, $http){ 

.... 

}