2
I’m having a hard time creating a loop with ng-repeat
, at the angle. Next... I wanted to create tags
for each projeto
that I add, example:
See that it is possible add more tags and there is also, in the end, a text, which when clicked adds a new project, called Add Projeto
, being like this:
THE PROBLEM: When I type a text for the tag projeto1
is inscribed at the same time under the tag of projeto2
! I imagine this is on account of {{tag.taagscliente}}
, that is being the same for each project. How I make this loop, without this conflict, I say, separate tags for each project? Project code below:
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.14/angular.min.js"></script>
<div ng-controller="dash">
<form action="">
<div class="col-3">
<div class="repeat" ng-repeat="projeto in clientes">
<label for="">Pasta Projeto</label>
<input type="text" name="projetos_cliente[]" ng-model="projeto.projetoscliente">
<label for="">Tags</label>
<div class="tags" ng-repeat="tag in taags">
<input type="text" name="tag_cliente[]" ng-model="tag.taagscliente">
<div class="del" ng-click="delTag($index)">-</div>
</div>
<div class="add" ng-click="addTag()">+</div>
</div>
<div class="clearfix"></div>
<div class="addx" ng-click="add()">Add Projeto</div>
</div>
</form>
</div>
ANGULAR:
var app = angular.module('app', ['ngTagsInput']);
app.controller('dash', function($scope, $http){
$scope.clientes = [{'text': 'Digite o projeto'}];
$scope.add = function () {
$scope.clientes.push({
projetoscliente:""
});
};
$scope.del = function (index) {
$scope.clientes.splice(index, 1);
};
$scope.taags = [{'text': 'Digite o projeto'}];
$scope.addTag = function () {
$scope.taags.push({
tagscliente:""
});
};
$scope.delTag = function (index) {
$scope.taags.splice(index, 1);
};
});
I offer 100 reputation points for your next question on http://answall.com.
– Lollipop
Someone??????????
– Lollipop