私は損失または利益であるかどうかに応じて、$ 1.5金額で$ Money金額を赤または緑で書き込むよう指示を作成します。角度1.5 - お金の色を表示するカスタムディレクティブ
<div financial-Color amount="model.Money"></div>
マイカスタムディレクティブは、これまでのところ、私は色の通貨で$マネーの量を書き出すんどのようにこのようになりますか?
app.directive('financialColor', function() {
return {
restrict: 'EA',
scope: {
'amount': '='
},
link: function (scope, element, attrs) {
scope.$watch('amount', function (condition) {
if (attrs.amount<0) {
element.css('color', 'red');
}
if (attrs.amount > 0) {
element.css('color', 'green');
};
});
}
}
何が欲しいですか? model.Moneyは通貨フォーマットになりますか? –
はい、終了結果は