Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

继承问题 #2

Open
memotail opened this issue Dec 11, 2014 · 1 comment
Open

继承问题 #2

memotail opened this issue Dec 11, 2014 · 1 comment

Comments

@memotail
Copy link

https://github.com/angular-cn/ng-nice/blob/master/core/data/base.js#L12

在base里面定义了self = this;
get_list_age 则直接使用self,会出现个问题

post、user都继承于base,导致最后获取post列表时候,里面的self.model使用了user的。
初步认为,post、user 使用同一个base为原型,在base原型里面保存self,导致共用一套的原型最后保存的model为user的。

然后,我就在get_list_page方法里面定义var self = this;最外面保存的self注释掉, 就没问题了。
你看下代码是不是存在这个问题?

@why520crazy
Copy link
Member

应该有这个问题存在,我在其他项目中碰到过,好久没有修改这里面的代码了,多谢提醒。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants