如何从AngularJS控制器启动UIKIT通知



我想在系统登录后或通过密码或用户不正确的登录登录时启动UIKIT通知。我认为我可以使用AngularJS来做到这一点。在我尝试登录时的项目中,首先将数据发送到一个控制器,该控制器将此数据发送给Django视图。

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';
        }
    );
}
}])

在上面的coningreso.js文件中,我尝试在窗口之前进行操作。Location...

但不起作用

谢谢

它的

UIkit.notify

您正在使用

UIkit.notification

最新更新