<div id="playZone"></div> <div class="row"> <div class="col-md-6"> <div class="card" ng-repeat="cards in ['one','two','three']" ng-click="cardMove()" > {{cards}} </div> </div> </div> - Please specify what exactly you want to convey? - Roman Danilov
- With the help of cardMove () html which creates ng-repeat (three divas with the 'card' class) would be copied when you click on any of them to div with id = 'playZjone'. Well, like this.innerHTML = document.getElementById ('playZone'). InnerHTML - Romanyuk Roman
- Why do you want to do this? Explain in question the final goal that you want to achieve. - Stepan Kasyanenko
- Such a goal I click on "one" jumps to div with id = "playZone", I click on "three" jumps over "three". - Romanyuk Roman
- How to catch on div created on the fly ng-repeat? - Romanyuk Roman
|
1 answer
In general, an angular is done like this:
angular.module('ExampleApp', []) .controller('ExampleController', function() { var vm = this; vm.currentCard = null; vm.cardMove = function(card) { vm.currentCard = card; } }); <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.23/angular.min.js"></script> <div ng-app="ExampleApp"> <div ng-controller="ExampleController as vm"> <div id="playZone">Playzone: {{vm.currentCard}}</div> <div class="row"> <div class="col-md-6"> <div class="card" ng-repeat="card in ['one','two','three']" ng-click="vm.cardMove(card)"> {{card}} </div> </div> </div> </div> </div> |