In the block that is filled with ng-repeat there is a block
<div class="col-xs-12 col-md-12 main-block-history" ng-repeat="order in orders"> <div class="row block-history-footer"> <div class="col-xs-12 col-md-6 action-accordion-history"> <a>Развернуть</a> </div> </div> <div class="row block-history-body" style="display: none; opacity: 0;"> </div> </div> After that, a post request is sent to the controller and the $ scope.orders variable is populated and the content of the block is filled accordingly, but the events are not tied to the blocks with the action-accordion-history class.
var app = angular.module('BlankApp', ['ngMaterial']); app.controller('BlankAppController', function ($scope, $http) { $http({ url: "dirService", method: "post", headers: { "Content-Type": "application/json; charset=utf-8", "dataType": "json" }, data: "{ 'token': '" + getCookie("token") + "' }" }).then(function (response) { $scope.orders = response.data.d; $('.action-accordion-history').on('click'); }); }); $(function () { $(".action-accordion-history").click(function () { var block = $(this).parent().parent().find(".block-history-body"); if (!block.is(":visible")) { block.show(); block.stop().animate({ opacity: 1 }, 150); $(this).html("<a>Свернуть</a>"); } else { block.stop().animate({ opacity: 0 }, 150, function () { block.hide(); }); $(this).html("<a>Развернуть</a>"); } }); }); How to be. How to bind the click event to the created blocks with the action-accordion-history class? The problem is that if an event is created with the help of ng-click on the controller, that the function must be passed a link to the controller on which event the event occurred, but I did not find how to do it.
ng-clickto the desired element - Grundy