Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dependency Injection Issue #413

Open
mikemicmike opened this issue Jan 9, 2018 · 0 comments
Open

Dependency Injection Issue #413

mikemicmike opened this issue Jan 9, 2018 · 0 comments

Comments

@mikemicmike
Copy link

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-dom.development.js?version=' + window.ocxRouterVersion,
      window.ocxExternalDependenciesPath + 'react-tooltip/standalone/react-tooltip.min.js?version=' + window.ocxRouterVersion
    ],
    serie: true
  }
])
.directive('ocxGrid', ['$timeout', '$parse', '$ocLazyLoad', '$q', function($timeout, $parse, $ocLazyLoad, $q){

  let g_localDico = ocxGridDico.localisation[utils.getLanguage()];
  let c_pinLocation = {
    left: "left",
    right: "right"
  }

  //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]);
    }
  };
}]);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant