AngularJS を既存のアプリケーションに組み込む方法を見つけようとしています。アプリケーションはモジュール式であるため、すべてのモジュールに HTML マークアップと JS スクリプト ファイルがあります。モジュールはrequirejsとjQueryでロードされます(マークアップをロードするため)。
将来 AngularJS に移行する可能性を念頭に置いて、いくつかのモジュールで AngularJS の機能を使用したいと考えています。したがって、理想的には、次のようなものが必要です。
define([ 'angular' ], function (angular) {
return function (element) {
// The "element" parameter contains the reference to
// the detached DOM node that contains the markup.
// And what I think should be done is compiling
// or initializing AngularJS with the given DOM HTML fragment
// and with controller, etc.
angular.doSomething(element, ...something...);
// The application module engine will inject the returned element
// into the DOM tree.
return element;
};
});
何か案は?ありがとう!