这可能不是angularJS的问题,但我在这里已经无计可施了。代码如下所示:
prep.directive('resultgraph', function () {
return {
restrict: 'A',
link: function (scope, element, attrs) {
//** scope accessible here **
DomReady.ready(function () {
ThreeBox.preload([
'/scripts/lib/snippets.glsl.html',
], function () {
//....scope not accessible here我如何访问'preload‘的回调函数中的作用域,它说这里不能访问作用域?
发布于 2015-01-14 00:32:51
如果您需要准备好DOM,您可以在link函数中执行此操作(作用域将是可访问的):
$timeout(function(){
alert('DOM ready');
//** scope accessible here **
});https://stackoverflow.com/questions/27920293
复制相似问题