javascript - How to automatically close an alert on JHipster? -


i have discovered , started develop in jhipster.

one of first hurdles i'm facing close automatically alerts. far, have learned jhipster uses bootstrap ui alerts, i'm trying adapt alerts bundled in sample project of jhipster, shown in home when user tries log in (the 1 in green):

enter image description here

html code alerts follows:

        <div ng-switch="vm.isauthenticated()">             <div class="alert alert-success" ng-switch-when="true" data-translate="home.logged.message" translate-values="{username: '{{vm.account.login}}'}">                 logged in user "{{vm.account.login}}".             </div>         </div> 

which modified such this:

            <div class="alert alert-success" ng-switch-when="true" data-translate="home.logged.message" translate-values="{username: '{{vm.account.login}}'}" close="closealert()" ng-if="show" dismiss-on-timeout="3000" >                 logged in user "{{vm.account.login}}".             </div> 

javascript file home.controller.js looks this:

(function() { 'use strict';  angular     .module('pruebablogapp')     .controller('homecontroller', homecontroller);  homecontroller.$inject = ['$scope', 'principal', 'loginservice', '$state', 'alertservice'];  function homecontroller ($scope, principal, loginservice, $state, alertservice) {     var vm = this;      vm.account = null;     vm.isauthenticated = null;     vm.login = loginservice.open;     vm.register = register;     $scope.$on('authenticationsuccess', function() {          getaccount();     });      getaccount();      function getaccount() {         principal.identity().then(function(account, $scope) {             vm.account = account;             vm.isauthenticated = principal.isauthenticated;              if (vm.isauthenticated){                 $scope.show = true;                 }          });     }     function register () {         $state.go('register');     }       function closealert () {         $scope.show = false;     } } })(); 

this method not working me. i've tried other approaches, such this one or this one (which should work button clicks).

what doing wrong?

jhipster using alertservice service in order create messages type want create (e.g. info, warning, danger etc.) , message displayed tag. have @ entities in sample app see tag jhi-alert in action. write tag in html site , create in controller alertservice message want create , display.

@gaƫl marziou answer more deep of happening behind scene. can see it?


Comments

Popular posts from this blog

inversion of control - Autofac named registration constructor injection -

verilog - Systemverilog dynamic casting issues -

ios - Change Storyboard View using Seague -