Happy day everyone,
I have started to work on angular-seed project. I have found jsfiddle with TODO example and would like to add another <input type-"text">
Is there any ways to split <input type-"text">
to make it look like two <input type-"text">
in the same row? My idea is similar to this jsfiddle made with jQuery, where merged string should be added to the <li>
element
many thanks,
app.html
<div ng-controller="MyCtrl">
<input type="text" ng-model="enteredName" />
<button ng-click="addName()">Add</button>
<ul>
<li ng-repeat="name in names">
{{ name }}
<button ng-click="removeName(name)">×</button>
</li>
</ul>
</div>
app.js
var myApp = angular.module('myApp',[]);
function MyCtrl($scope) {
$scope.names = ['batman', 'grumpy', 'yulu'];
$scope.addName = function(){
$scope.names.unshift($scope.enteredName);
}
$scope.removeName = function(name) {
var i = $scope.names.indexOf(name);
$scope.names.splice(i, 1);
}
}