How to change the color of entered text in the output [Resolved]

Posted by Nagamohan under AngularJS on 11/11/2016 | Points: 10 | Views : 597 | Status : [Member] | Replies : 1
Here is my code
<!DOCTYPE html>
<html>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular.min.js"></script>
<style>
h1{
color:green;
}
</style>
<body>

<div ng-app="myApp" ng-controller="myCtrl">
Name: <input ng-model="name">
<h1>You entered:</h1> {{name}}
</div>

<script>
var app = angular.module('myApp', []);
app.controller('myCtrl', function($scope) {
$scope.name = "Angularjs";
});
</script>
</body>
</html>






Responses

Posted by: Manideepgoud on: 11/11/2016 [Member] Starter | Points: 50

Up
0
Down

Resolved
Dear Mohan solution to your probem is here , try this
Apply
<span style="color:blue;font-size:20px;">{{name}}</span>

This will change the color and fontsize of the output when you type input text
<!DOCTYPE html>
<html>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular.min.js"></script>
<style>
h1{
color:green;
}
.name{
color:blue;
}
</style>
<body>

<div ng-app="myApp" ng-controller="myCtrl">
Name: <input ng-model="name">
<h1>You entered:</h1> <span style="color:blue;font-size:20px;">{{name}}</span>
</div>

<script>
var app = angular.module('myApp', []);
app.controller('myCtrl', function($scope) {
$scope.name = "Angularjs";

});
</script>
</body>
</html>


Nagamohan, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response