Discussions

Ask a Question

how to load component with templateUrl?

could you give me demo ?

Dependency Injection not working properly

My understanding of the dependency injection was that it would load all of the files and AFTER all of them are loaded and executed it would process the Javascript. At the moment i have some dependency injections but the code in my .directive on the module im loading is being run ahead of time. When i try to add code about the stuff being loaded in the .directive (not the link just before the return) I sometimes get an error saying that ex: React has not been loaded or whatever other source hasn't finished executing. angular.module('ocxGrid', [ ["../directives/ocx-grid/ocx-grid.min.css?version=" + window.ocxRouterVersion, window.ocxExternalDependenciesPath + 'jqueryUIMinimal/jquery-ui-1.10.4.custom.min.css?version=' + window.ocxRouterVersion, window.ocxExternalDependenciesPath + 'jqueryUIMinimal/jquery-ui-1.10.4.custom.min.js?version=' + window.ocxRouterVersion ], { files: [ window.ocxExternalDependenciesPath + 'react/react.development.js?version=' + window.ocxRouterVersion, //window.ocxExternalDependenciesPath + 'react/react.production.min.js?version=' + window.ocxRouterVersion, window.ocxExternalDependenciesPath + 'react/react-dom.development.js?version=' + window.ocxRouterVersion, //window.ocxExternalDependenciesPath + 'react/react-dom.production.min.js?version=' + window.ocxRouterVersion, window.ocxExternalDependenciesPath + 'react-tooltip/standalone/react-tooltip.min.js?version=' + window.ocxRouterVersion ], serie: true } ]) .directive('ocxGrid', ['utils', '$timeout', '$parse', '$ocLazyLoad', '$q', function(utils, $timeout, $parse, $ocLazyLoad, $q){ ; //This will insert here a concatenated version of all the files in components folder /* ocx file insert */ return { restrict: 'E', scope: { gridOptions:'=oaGridOptions' }, template: '<div></div>', link: function(p_scope, p_element, p_attrs){ ReactDOM.render(<OcxGrid options={p_scope.gridOptions}/>, p_element[0]); } }; }]);

After loading module there are no factory

I got a code ``` (function(){ angular .module('MyApp') .run(_run); _run.$inject = ["$rootScope", "settings", "$ocLazyLoad"]; function _run($rootScope, settings, $ocLazyLoad) { // START loading $ocLazyLoad.load('UserModule').then(function(d){ console.log(d); console.log(user); }); // END loading // INIT or define some data $rootScope.$settings = settings; } })(); ``` but after `UserModule` loaded there is no `user` factory What am I doing wrong?

Redirect state to otherwise after refresh page

Hello... I create an issue on stackoverflow please read it, https://stackoverflow.com/questions/48238918/redirect-state-to-otherwise-after-refresh-page Thanks ... pls help :'(
ANSWERED

why sometime dependencies not work

I try implement d3 chart in angularjs but I don't know why sometimes dependencies not work fine. http://plnkr.co/edit/nycsT8NjW0AHRWCthW60?p=preview

rerun contents of lazylaoded file

Hi, I have breakpoints in my lazyload file. It only gets hit on first load of the page. However, i have the lazyload directive set to run when certain buttons are clicked and its not happening. I need the contents to reload as the DOM has changed. Lazyload looks like this: (function () { 'use strict'; angular.module('lazyloadCtrl', ['filesService']) .controller('lazyloadCtrl', ['Files', '$ocLazyLoad', '$scope', '$rootScope', '$compile', function (Files, $ocLazyLoad, $scope, $rootScope,$compile) { $rootScope.$emit('initLazyLoad'); $rootScope.$on('initLazyLoad',function(event,args){ $ocLazyLoad.load( [{ name: 'Callout_Email', files: ['/scripts/services/lazyload.js'], rerun: true } ]) .then(function success(args) { $ocLazyLoad.load( [{ name: 'Callout_PeoplePicker', files: ['/scripts/services/sp.email.js'] } ]) .then(function success(args){ var temp = document.getElementsByClassName('scEmailLink'); angular.forEach(temp, function(value,key){ value.onclick = function(e){ angular.element('#peoplepickerElm' + key).toggle(); //console.log("Hooked into element: peoplepickerElm" + key); }; }, this); console.log("Callout_PeoplePicker success: " + args); }, function error(err){ console.log("Callout_PeoplePicker fail: " + err); }); return args; }, function error(err) { console.log("Callout_Email fail: " + err); console.log(err); return err; }); }); }]); }()); The contents of the files are not angular. They are SharePoint. And because the DOM has changed, i need them reloaded/reran, but when i run $rootScope.$emit('initLazyLoad'); from another part of my application, these files are not getting reloaded. Any suggestions? Thanks

Lazy loading not working with dynamically added html import

Hi, Based on user role , i am dynamically adding the <link > with rel="import" to import the directive , this directive uses ocLazyload attribute to load all the dependencies, the dependencies are not loaded. where as if i use html import directly in head tag its working(not dynamic loading). please suggest

ocLazyLoad error promise result

If error occurs during load, ocLazyLoad rejects the promise with following: .error(function (err) { deferred.reject(new Error('Unable to load template file "' + url + '": ' + err)); }); Here, original err result is converted to string and details such as status code are lost. I needed the status code to check 403 and handle the error. Is there any other way to access to status code?

ocLazyLoad File not found

I have try to implement ocLazyLoad but getting error when it load Error: http://errors.angularjs.org/1.5.5/ng/areq?p0=loginController&p1=not%20a%20function%2C%20got%20undefined $stateProvider .state('Login', { url: '/', templateUrl: 'View/Login.jsp', controller : 'loginController', containerClass: 'lock-screen', pageLayout:'beforeLogin', PageTitle:'Login - FORTLABS', resolve:{ Login : function($ocLazyLoad) { return $ocLazyLoad.load( { name: "Login", files:['js/Controller/loginController.js'] } ) } } })

Loading a file with chunkhash with webpack (dynamic name)

How can I implement of loading a file that has a changing chunkhash in it's name?Using webpack 3 and the new ui router. For example loading a user_management.84bd6a8d34d479d388a8.js.