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

Angular2想在模板渲染之后执行jquery写的函数应该怎么做…… #5

Open
IShinji opened this issue Jan 12, 2016 · 4 comments

Comments

@IShinji
Copy link

IShinji commented Jan 12, 2016

引用了foundation,发现组件需要在模板渲染后执行$(document).foundation();
谷歌没找到答案……

@kittencup
Copy link
Owner

你的需求不是其中某一个模板渲染完,而是整个App渲染完

bootstrap(App,[]).then(()=>{
    $(document).foundation();
})

@IShinji
Copy link
Author

IShinji commented Jan 12, 2016

It works.但编译ts的时候报了一个错
Argument of type 'Document' is not assignable to parameter of type 'string'.
这个有解决方案么?

@kittencup
Copy link
Owner

我猜你使用的是 angular2-webpack-starter 脚手架,然后自己下载了jquery.d.ts?

angular-protractor.d.tsjquery.d.ts 的 $ 会冲突。

可以参考
PatrickJS/PatrickJS-starter#215
PatrickJS/PatrickJS-starter#214

这块不属于ng2的范围了,所以就答到此处了,具体可以通过google解决该问题

@IShinji
Copy link
Author

IShinji commented Jan 13, 2016

没用用手脚架……直接引用的jq……
恩,问题不大,我先用着。我再google翻翻看

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

No branches or pull requests

2 participants