エラーメッセージをビューに表示しようとしました。コントローラからのサービスコールが404になると、パスはログインページビューにリダイレクトされ、エラー404が発生したときに表示する$ scopeにメッセージが設定されています。以下ビューにエラーメッセージを表示する必要があります。コントローラにエラーメッセージが設定されています。
は)] 404は
angular.module('app.controllers').controller('contactLoginCtrl',['$rootScope','$scope','AuthenticateService','$location',function($rootScope,$scope,AuthenticateService,$location){
$scope.authenticate = function(userModel){
var userName = userModel.username;
var password = userModel.password;
console.log(userName+password);
var result = AuthenticateService.checkUser(userName,password);
result.then(function(response){
console.log(response);
},function(error){
if(error.status== '404'){
// ***below is the erroMssg which has to show on the view,
after setting the message it being redirected to login view***
$scope.errorMsg = "your request not been processed";
$location.path('/');
}
})
};
}を発生したときに$スコープにエラーメッセージを設定する制御コードです。私はこれが動作していない{{}} errorMsg内容
としてerrorMsg内容の表現を配置していますビューで
は、誰もが私にどんなトレーニングを提案してくださいだろうか?事前に感謝します
を有するであろうHTMLコード – Sajeetharan
を示し{{errorMsg内容}} <フォーム名= "contactLogin" NGコントローラ= "contactLoginCtrl"> の \t \t \t \t \t \t <= "パスワード" のラベル> /> \t \t \t \t \t \t <ボタンタイプ=名前を "送信" = "ログイン" NG-C > "(userModel)を認証" =なめるログイン \t \t \t \t \t \t \t \t \t \t \t – user1245524