Is it possible to use scripts of Extjs in external html?
Asked Answered
K

0

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?"

Kike answered 28/5, 2015 at 12:42 Comment(8)
What is the code in testController.js and how does the html file interact with it?Detwiler
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).Kike
You should adjust your question title, your question is more like, How to apply an angular controller to HTML that is loaded dynamically.Detwiler
You need to $compile the HTML and give it a scopeDetwiler
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.Kike
It must have something to do with your question, you have explain how the JS and the HTML interactDetwiler
can you give a concrete example for me to see how to use that in my case for angular? @JuanMendesKike
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.Detwiler

© 2022 - 2024 — McMap. All rights reserved.