This repository has been archived by the owner. It is now read-only.

Specifying root-el prevents vm.form from being populated #279

Closed
s992 opened this Issue May 8, 2015 · 2 comments

Comments

Projects
None yet
2 participants
@s992
Copy link

s992 commented May 8, 2015

JSBin example: http://jsbin.com/molulomugi/1/edit?html,output

I tried to write a failing test for it, but I can't get the tests running on my system.. looks like an issue with the Babel loader. The failing test would probably look like this:

it(`should place the form control on the scope property defined by the form attribute when root-el is specified`, () => {
  compileAndDigest(`
    <formly-form root-el="div" form="vm.myForm" model="model" fields="fields"></formly-form>
  `);
  expect(scope.vm).to.have.property('myForm');
  expect(scope.vm.myForm).to.have.property('$name');
});
@kentcdodds

This comment has been minimized.

Copy link
Member

kentcdodds commented May 8, 2015

If you use anything other than

or then there's no form
controller to provide you with. So that simply wouldn't even make sense in
that case.

The solution is to wrap the in an ng-form or form which has a
name attribute, and pass that same value to the formly-form form attribute.

  • Kent C. Dodds

(Sent from my mobile device, please forgive typos or brevity)
On May 8, 2015 12:42 PM, "Sean Walsh" notifications@github.com wrote:

JSBin example: http://jsbin.com/molulomugi/1/edit?html,output

I tried to write a failing test for it, but I can't get the tests running
on my system.. looks like an issue with the Babel loader. The failing test
would probably look like this:

it(should place the form control on the scope property defined by the form attribute when root-el is specified, () => {
compileAndDigest(<formly-form root-el="div" form="vm.myForm" model="model" fields="fields"></formly-form>);
expect(scope.vm).to.have.property('myForm');
expect(scope.vm.myForm).to.have.property('$name');
});


Reply to this email directly or view it on GitHub
#279.

@s992

This comment has been minimized.

Copy link
Author

s992 commented May 8, 2015

D'oh! Makes sense. Thanks :)

@s992 s992 closed this May 8, 2015

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.