@anicacute09 wrote:
Hi guys, I am finding difficulty in passing variables to parameters..
here is my controller:
.controller('MessagesCtrl', function ($scope, $http) {
$scope.details = {}; $scope.getData = function () { $http.get("http://localhost/colombiandreamdate/v1/userlogin", { params: { username: scope.details.username, password: scope.details.password } }) .success(function (data) { $scope.id = data.id; $scope.username = data.username; $scope.role = data.role; $scope.date_created = data.date_created; }) .error(function (data) { alert("Something Went Wrong"); }); }
});
and my ng-submit="getData()" form is like this(i cant use the form tag here sorry just imagine the it is close in form ng-submit="getData()":
<div class="list list-inset signin-input"> <label class="item item-input signin-input"> <i class="icon ion-email placeholder-icon custom-icon"></i> <input type="email" ng-model="details.username" placeholder="Email" required> </label> </div> <div class="list list-inset signin-input"> <label class="item item-input signin-input"> <i class="icon ion-locked placeholder-icon custom-icon"></i> <input type="password" ng-model="details.password" placeholder="Password" required> </label> </div> <div class="padding-horizontal"> <button class="button button-block button-assertive btn-login"> Login </button> </div>
when I click the button and use ex: {{id}} it doesn't show and gives me an error the $scope is not defined
Posts: 1
Participants: 1