dijit.byId(QUOT;")不工作灯定义的angularjs工作 [英] dijit.byId("").is not defined in worklight works with angularjs
问题描述
我在做一个工作灯项目中使用道场移动1.8.1和1.0.1 angularjs,但我得到了一个奇怪的问题。
I make a project in worklight used dojo mobile 1.8.1 and angularjs 1.0.1,but i got a strange problem.
这是我的HTML的一部分。
here is my html part.
<div data-dojo-type="dojox.mobile.ScrollableView" data-dojo-props="selected:true" id="id1" ></div>
<div class="full" data-dojo-type="dojox.mobile.View" id="id2"></div>
和我的JavaScript部分:
and my javascript part:
require([
"dojo", "dijit/_base/manager","dojo/parser", "dijit/registry",
], function(dojo) {
dojo.ready(function() {
// dijit.byId("id1").performTransition("id2"); //////////place I
});
});
var angularApp = angular.module('app', [])
.run(['$rootScope','$templateCache','$route',
function($rootScope,$templateCache,$route) {
dijit.byId("id1").performTransition("id2");////////place II
}]);
问题是:
在我的地方,它工作得很好,但是当我把dijit.byId(ID1)在地方II,
显示dijit.byId()。没有定义。
at place I,it works well,but when i put "dijit.byId("id1")" at place II, it shows "dijit.byId("").is not defined".
急,有没有任何人能帮助我吗?非常感谢。
urgency,is there anyone can help me ? thanks very much.
推荐答案
在道场解析您的文档和放大器执行的准备功能;构建的小部件,你试试用dijit.byId就搞定了。
The ready function is executed after dojo parsed your document & constructed the widgets you try to get using dijit.byId.
第二部分是不放在ready函数内,所以道场无法找到你的元素呢!
The second part is not placed within the ready function, so dojo can't find your elements yet !
!解决方法:访问您的元素就绪功能或不声明声明它们(像你这样,使用HTML code ...)
Solution: Access your elements in the ready function OR do not declare them declaratively (like you did, using html code...) !
卢西恩
这篇关于dijit.byId(QUOT;&QUOT;)不工作灯定义的angularjs工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!