Download jQuery after AngularJS

I am trying to run a small jQuery fragment after a full page load, but some AngularJS code does not appear even after a full page load.

jQuery runs in the console after the page loads.

This jQuery is trying:

jQuery("a:contains('Clone')").parent().parent().parent().prepend(jQuery("#clone_external"));

But still it does not happen

The clone button is not a normal button, it is an angular button

`<div ng-init="projectPath='projects.srk_test_pro_ject';artifactId='artf3596';folderId='tracker1787';folderPath='projects.srk_test_pro_ject/tracker.ACR';returnUrlKey='1494858605684';hasCreatePermission='true'" data-ng-include="'/ctf/js/saturn/tracker/cloneArtifact.html'" ng-bindable="" class="Middle ng-scope"><div data-ng-controller="CloneCtrl" class="ng-scope"><a href="#" data-ng-show="!disableCloneBtn" data-ng-click="clone()" data-i18n-content="{bundle: 'tracker', key: 'clone/label'}" class="">Clone</a></div></div>`

I tried to prepare the document and upload together, but still no luck

jQuery(document).ready(function() {
   jQuery(window).load(function() {
     jQuery("a:contains('Clone')").parent().parent().parent()
     .prepend(jQuery("#clone_external"));
   });
});

I would prefer a javascript / jQuery solution over an angular solution.

+4
source share
1 answer

Inside your angular controller corresponding to this view, you can do the following:

.controller('MyCtrl', [function($scope) {
    $scope.$on('$viewContentLoaded', function(){
        // here your jQuery code
    });
}]);

: angular jQuery (jQlite), , , jQlite jQuery. , jQlite/jQuery , , " ", .

0

Source: https://habr.com/ru/post/1677182/


All Articles