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

Add injectNames to use DI in react2angular #49

Merged
merged 7 commits into from
Dec 11, 2017
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
this.injectedProps must be an object
  • Loading branch information
fand committed Dec 7, 2017
commit 225b37ec2610f1ad851c13506c10c34a2e96ace6
7 changes: 5 additions & 2 deletions index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,13 @@ export function react2angular<Props>(
return {
bindings: fromPairs(names.map(_ => [_, '<'])),
controller: ['$element', ...injectNames, class extends NgComponent<Props> {
injectedProps: any[];
injectedProps: { [name: string]: any }
constructor(private $element: IAugmentedJQuery, ...injectedProps: any[]) {
super()
this.injectedProps = injectedProps;
this.injectedProps = {}
injectNames.forEach((name, i) => {
this.injectedProps[name] = injectedProps[i]
})
}
render() {
// TODO: rm any when https://github.com/Microsoft/TypeScript/pull/13288 is merged
Expand Down