I know that similar questions can be found, but no answer worked for me. I want to show a html, for example <h5>Your password is incorrect</h5> when i encounter bad credentials at login. So this code should be "made alive" from inside the controller. Here's how mine looks like:
( function () {
'use strict';
angular
.module( 'app.home' )
.controller( 'ploginController', ploginController );
ploginController.$inject = [ '$scope', '$location', '$state', '$http' ];
/* @ngInject */
function ploginController( $scope, $location, $state, $http ) {
$scope.submit = function () {
$http.post( '/api/v1/person/login', $scope.add, {
headers: {
'Content-Type': 'application/json'
}
} ).then( function ( respSucc ) {
$state.go( 'layout.listcampaigns' );
return respSucc;
}, function ( respErr ) {
//i think code revealing method should be HERE, but how??
return respErr;
} );
};
}
} )();
Thanks in advance!