如何使用角度指令调用道场DOM操作code [英] How to use angular directives to call dojo DOM manipulation code

查看:121
本文介绍了如何使用角度指令调用道场DOM操作code的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经想通指令模板和templateUrl这里的区别
<一href=\"http://stackoverflow.com/questions/22184761/the-load-sequence-difference-between-template-and-templateurl-in-angular-directi\">The在角指令模板和templateUrl之间的负载序列差异

I've figured the difference between directive template and templateUrl here The load sequence difference between template and templateUrl in angular directive

我的问题是如何利用角度和Dojo在一起。

My question is how to use Angular and Dojo together.

如果我把Dojo小部件在角指令templateUrl,

If I place Dojo widget in templateUrl of angular directive,

FamilySnapModule.directive('homePickdata', function() {
    return  {
        restrict: 'EAC',
        replace: true,
        transclude: true,
        templateUrl: 'familysnap/templates/homePickdata.html'
        //template: '<div id="calendar_month_datepicker" data-dojo-type="dojox.mobile.SpinWheelDatePicker" data-dojo-props=\'slotOrder: [0,1,2], monthPattern: "MM", dayPattern: "dd", align: "center"\'></div>'
        };
    });

familysnap /模板/ homePickdata.html

familysnap/templates/homePickdata.html

<div id="calendar_month_datepicker" data-dojo-type="dojox.mobile.SpinWheelDatePicker" data-dojo-props='slotOrder: [0,1,2], monthPattern: "MM", dayPattern: "dd", align: "center"'></div>

然后

require([
         "dojox/mobile/SpinWheelDatePicker",
         ], function(dom, ready, registry, SpinWheelDatePicker,SwapView) {
    registry.byId('calendar_month_datepicker'); 
}

将返回null。

will return null.

因此​​,如何利用角度和Dojo一起?

So how to use angular with dojo together?

推荐答案

该指令是动态加载,这意味着道场不会解析声明标记成一个小部件。它不仅会在该网页上加载(配置时),或当手动调用。

The directive is dynamically loaded, which means that Dojo will not parse the declarative markup into a widget. It only does that on page load (when configured) or when manually invoked.

因此​​,为了解决这个问题,你将不得不被加载指令时调用道场解析器。你应该看看 道场/分析器 模块。

So, in order to solve this problem you will have to invoke the Dojo parser when the directive is loaded. You should look at the dojo/parser module.

这篇关于如何使用角度指令调用道场DOM操作code的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆