Ändern Sie die Textfarbe mit AngularJs

Post a reply

Smilies
:) :( :oops: :chelo: :roll: :wink: :muza: :sorry: :angel: :read: *x) :clever:
View more smilies

BBCode is ON
[img] is ON
[flash] is OFF
[url] is ON
Smilies are ON

Topic review
   

Expand view Topic review: Ändern Sie die Textfarbe mit AngularJs

by Anonymous » 09 Apr 2025, 20:55

Ich habe diesen Teilcode: < /p>

Code: Select all

     ng-class="{'color-red': $ctrl.clientStatus === 'Error', 'color-blue': $ctrl.clientStatus === 'Warning', 'color-green': $ctrl.clientStatus === 'OK'}">
Status: {{$ctrl.filesToUploadClientStatus}}
< /code>

Und dieser Komponentencode: < /p>

(function (app) {
app.component('uploadFilesComponent', {
templateUrl: 'partials/upload-files-partial.html',

// bindings: {filesToUpload: '=', hasFilesOnServer : '='},
controller: ['$scope', '$state','uploadService', function ($scope, $state, uploadService) {

...

var self = this;

var NO_FILES_TO_UPLOAD = "No files to upload";
var WAITING_FOR_UPLOAD = "Waiting for upload";

self.clientStatus = self.filesToUploadClientStatus.contains(WAITING_FOR_UPLOAD) ? 'OK' : 'Error';
...
}
< /code>

Warum erhalte ich beim Hinzufügen eines HTML? < /p>

ng-class="{'color-red': $ctrl.clientStatus === 'Error', 'color-blue': $ctrl.clientStatus === 'Warning', 'color-green': $ctrl.clientStatus === 'OK'}">
Status: {{$ctrl.filesToUploadClientStatus}}

Top