Good night everyone ... I have a problem, I can't decide who will help. I will be grateful.

there is an angular model

var phonecatApp = angular.module('phonecatApp', []); phonecatApp.controller('PhoneListCtrl', function($scope){ $scope.phones = journal }); 

and the list in which I bring the variable log

 <ul> <li ng-repeat="phone in phones"> <p>{{phone.name}}</p> </li> </ul> 

In the variable log are the master, one of them I need to attach to the order when you click

I NEED AN ELEMENT WITH A CLICK ON THE ELEMENT TO PUT IT INTO A VARIABLE

like this

 <ul> <li> <p id="one">Григоривй</p> </li> <li> <p id="two">Андрей</p> </li> </ul> $(document).ready( function () { $("#one").bind("click", addSpectorOne); }); function addSpectorOne () { var a = $('#one').text(); } $(document).ready( function () { $("#two").bind("click", addSpectorTwo); }); function addSpectorTwo () { var a = $('#two').text(); } 
  • <li ng-repeat="doer in $ctrl.doers" ng-click="$ctrl.handlerDoerAppend(item)"> - nörbörnën
  • Do not ask the same question several times. It is better to edit the very first. - Grundy
  • I recommend to get acquainted , I started my acquaintance from this resource - Bald
  • one
    Please do not ask one question again and again. If you want to clarify your question - just edit it. - PashaPash

1 answer 1

why not create an array of wizards, like this:

 $scope.masters = []; $scope.select = function(master){ //реализация логики } 

and in the view to display it like phones

 <ul> <li ng-repeat="master in masters"> <p ng-click="select(master)">{{master.name}}</p> </li> </ul> 
  • Yes, actually, this is how it should be done. - Sergey Rogachev