div
関数が発生したときにのみ表示したい。
ここにHTMLがありますが、常に表示されています。関数がtrueの場合にのみ表示したい
<div ng-controller="controller">
<div ng-show="data.show"> Successfully triggered </div>
<div ng-hide="!(data.hide)"> Error in triggering</div>
</div>
私が持っているコントローラで:
if(results.data=='success') {
$scope.data = {
show: false,
hide: true
};
//Here I should display the success message
} else {
//Here I should display the error message
}
では、if 条件で成功を、else 条件div
でエラーを示すにはどうすればよいでしょうか。div
注 :可能であればdiv
、スロー モーションで表示されると非常に役立ちます。jQuery のフェード タイミングのように。