0

I have loaded manually written scripts to Extjs using: Ext.Loader.LoadScript

Ext.Loader.loadScript({
                url : './a-path/testController.js',
                onLoad : onLoad('loaded'),
                onError : onError
            });

I have also added an external html file using a panel:

var myTestPanel = Ext.create('Ext.panel.Panel', {
            title : 'Example 1',
            width : 250,
            height : 250,
            frame : true,
            loader: {
               url: './test.html',
               renderer: 'html',
               autoLoad: true,
               scripts: true
            }
    })

The question is "How can i use that loaded scripts in my external html file?"

Asqan
  • 4,319
  • 11
  • 61
  • 100
  • What is the code in testController.js and how does the html file interact with it? – Ruan Mendes May 29 '15 at 03:49
  • it is a angular controller file which is binded with a ng-app div. two way binding. That works if it is defined in html file but i should load it to Extjs to ensure that it won't be loaded each time (it is inefficient and in my case actually, you also cant load angular several times, it is a protection of angular). – Asqan May 29 '15 at 07:10
  • You should adjust your question title, your question is more like, [How to apply an angular controller to HTML that is loaded dynamically](http://stackoverflow.com/questions/20651578/how-to-bind-an-angularjs-controller-to-dynamically-added-html). – Ruan Mendes May 29 '15 at 12:09
  • 1
    You need to [$compile](https://docs.angularjs.org/api/ng/service/$compile) the HTML and give it a scope – Ruan Mendes May 29 '15 at 12:14
  • No, my question is not restricted only to load angular. The nature of the to be loaded js file has nothing to do with my question actually. – Asqan May 29 '15 at 12:15
  • It must have something to do with your question, you have explain how the JS and the HTML interact – Ruan Mendes May 29 '15 at 12:15
  • can you give a concrete example for me to see how to use that in my case for angular? @JuanMendes – Asqan Jun 01 '15 at 14:54
  • The link I posted has clear examples of how to use `$compile`. Unless you post your HTML, JavaScript and what you have tried, it's hard to help. – Ruan Mendes Jun 01 '15 at 14:56

0 Answers0