简体   繁体   中英

Add jQuery dependency in angularJs

How I can add jquery-ui.js to my controller.I'm new to the ui-router

.state('new_patient', {
            url: '/newpatient', 
            templateUrl: window.localStorage.getItem('contextPath') + '/module/laboratory/newpatient',
            controller: 'PatientController',
            resolve: {
                deps: function($q, $rootScope) {
                    var deferred = $q.defer();
                    var dependencies = ['jquery-ui'];
                    require(dependencies, function() {
                        $rootScope.$apply(function() {
                            deferred.resolve();
                        });
                    });

                    return deferred.promise;
                }
            }
        });

OR as follows

resolve: {        async: ['jquery-ui',  function($) {            
        }]
    }

pls help.. Its for working of an accordion.. Thanks in advance for replies.

.state('new_patient', {
            url: '/newpatient', 
            templateUrl: window.localStorage.getItem('contextPath') + '/module/laboratory/newpatient',
            controller: 'PatientController',
            resolve: {
                deps: function ($q){
                var defer = $q.defer();

                require(['js/core/jquery-ui'], function() {

                        defer.resolve(); 

                });

             return defer.promise;
            }
            }
        });

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM