更新时间:1970-01-01 07:56:42
好的,我已经解决了.
控制台在说我:
无法读取null的属性"rel".
Cannot read property 'rel' of null.
发生这种情况是因为我在var ItemGallery = function()
内部做的第一件事是更改下一页的href
(下一页来自ajax请求).下一页的href
位于当前页面底部的<div>
中.
This happened because the first thing I was doing inside var ItemGallery = function()
, was to change the href
for the next page (next page comes from ajax request). The href
for the next page is located within a <div>
in the bottom of the current page.
重点是,我要在当前页面加载之前更改下一页的href
.
The point is that I'm changing the href
for the next page, BEFORE the current page has been loaded.
所以..
window.onload = function () {
this.nextPageQueryString = document.getElementById("nextPage").rel;
this.next_href = this.domain_url + this.nextPageQueryString;
};
注意:这解决了我的问题,但是我觉得很奇怪.
ng-if
无法看到下一个href
的'rel'属性,我得到了空白页.现在Angular可以看到'rel'属性,并且一切正常.
NOTE: this has solved my problem, but I find it very strange.
ng-if
wasn't able to see the 'rel' property for the next href
and I got the empty page. Now Angular can see the 'rel' property and it all works fine.
ng-if应该可以与html中的功能分开使用.
ng-if should work apart of what I have in the html.
我仍然不了解ng-if
的行为.