JSFiddle - React, Tailwind, and code Playground
by Filipe Augusto Lima de Souza
HTML
<body ng-app='helloApp' ng-controller="helloController">
<h1>Name Multiplicator.</h1>
<input ng-model="name" placeholder="Name">
<input ng-model="times" placeholder="Times" type="number" min="0">
<p ng-repeat="obj in getTimes(times) track by $index" ng-show="name.length">Welcome {{name}} !</p>
</body>
JavaScript
angular.module('helloApp', [])
.controller('helloController', ['$scope', function ($scope) {
$scope.times = 1;
$scope.$watch('times', function (newValue, oldVaue) {
if (!angular.isNumber(newValue)) {
newValue = oldVaue;
alert('ENTER A VALID POSITIVE NUMBER PLEASE');
}
});
$scope.getTimes = function (n) {
if (angular.isNumber(n)) {
return new Array(n);
}
};
}]);