ASP.NET
、MVC5
、HTML5
およびを使用して Web サイトを開発していAngularJS
ます。
更新しました
Chrome コンソールに警告はありません。
font-awesome フォントは、私の Web プロジェクトにローカルにあります。
私のweb.configにはこれがあります:
<system.webServer>
<staticContent>
<remove fileExtension=".woff" />
<mimeMap fileExtension=".woff" mimeType="application/font-woff" />
<mimeMap fileExtension=".woff2" mimeType="font/woff2" />
<mimeMap fileExtension=".json" mimeType="application/json" />
</staticContent>
Angular のリクエストを行う関数が$http
あり、ボタンが押されたときにアイコン クラスを変更する必要があります。
現在、角度コントローラーには次のものがあります。
$scope.requested = false; // Initial value: false.
$scope.search = function (model) {
$scope.requested = true; // When the function is called.
$http({
method: "POST",
url: DFJB.systempath + "api/getdata",
data: model
}).success(function (data, status, headers, config) {
$scope.requested = false; // When the request is completed.
console.log(data);
}).error(function (data, status, headers, config) {
console.log("Error: " + status);
});
};
HTML5:
<button class="btn btn-primary" data-ng-disabled="frmModel.$invalid" type="submit">
<i data-ng-class="{'fa fa-search': requested == false, 'fa fa-refresh fa-spin': requested == true}"></i>
Search
</button>
ただし、正しく動作していません。
リクエストが完了すると、アイコンが元の不適切な外観に変わります。
私が視覚的に望むもの:
この問題を解決するための提案はありますか?
ありがとう。