Greetings everyone,
Currently, I am working on the angular-seed project. I came across a jsfiddle showcasing a TODO example and I want to include another <input type-"text">
Is there a method to split <input type-"text">
to display two <input type-"text">
in a single row? My concept is similar to this jsfiddle created with jQuery, where the combined string should be added to the <li>
element
Thank you very much,
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);
}
}