问题是 textAngular 的核心,期望一个变量rangy
在全球范围内可用(https://github.com/aaronroberson/textAngular/blob/master/src/main.js#L69)。
window.rangy
所以为了解决这个问题,我们在初始化应用程序之前将 rangy-core 和 rangy-selectionsaverestore 组合到我们的应用程序的引导程序开始时angular.module('appname', [modules...])
define(["angular", "ngRoute", "jquery", "rangy-core", "rangy-selectionsaverestore"], function(angular, ngRoute, $j, rangyCore, rangySelectionSavereStore) {
window.rangy = $j.extend(rangyCore, rangySelectionSavereStore);
});
requirejs 加载这两个模块的配置,
'rangy-core': '../bower_components/rangy/rangy-core',
'rangy-selectionsaverestore': '../bower_components/rangy/rangy-selectionsaverestore'