I want launch a uikit notification after login in my system or when I fail in the login by password or user incorrect. I think that I can to do it using AngularJS. In my project when I try login, first my data are send to a controller that send this data a django view.
login.html
<div class="input" ng-controller="conIngreso">
{% csrf_token %}
<div class="login-input-group spacer-field">
<span class="login-input-group-addon">
<i class="fa fa-at fa-fw"></i>
</span>
<input type="email" class="form-control" name="email" placeholder="Correo electrónico" ng-model="email">
</div>
<div class="login-input-group">
<span class="login-input-group-addon">
<i class="fa fa-key fa-fw"></i>
</span>
<input type="password" class="form-control" name="password" placeholder="Contraseña" ng-model="password">
</div>
<button class="btn btn-default btn-lg submit" type="submit" ng-click="ingresar(email, password)">Ingresar</button>
</div>
conIngreso.js
var app = angular.module('appLogin');
app.controller('conIngreso', ['$scope', '$http', function($scope, $http){
$scope.user={email:'',password:''}
$scope.ingresar=function(email,password){
$http({method:'POST',
url:'/cliente/ingreso/',
data:$.param({email: email, password: password})
}).then(
function(response2){
//UIkit.notification("...", {pos: 'top-right'});
window.location.href='javascript:history.back()';
},function(response2){
$scope.user = response2.data || 'Request failed';
}
);
}
}])
In the conIngreso.js file above I try to do it before window.location...
But does not work
Thanks