Page 1 of 1

Angular / Accordion Scope

Posted: Fri Aug 28, 2015 5:47 pm
by Chris Ryhal

I have an accordion with an input. I have named the ng-model for the input to "firstname"

Image

I'm just trying to now get the value of what the user will put within the input box using the defined scope. For testing, I am just trying to throw a JS Alert with my ng-click event on the "Save Settings" button.

Image

The alert does come up, but its just blank. If I move the input outside of the accordion all works as intended. Its my understanding that the accordion has its own "scope" but being completely new to all of this, I guess I'm not understanding how to get the value?

A simple snippet of code would be of great assistance for me.


Angular / Accordion Scope

Posted: Fri Aug 28, 2015 7:42 pm
by Serhii Kulibaba

Hello Chris,

Please add Model with children elements: http://prntscr.com/89zy2m
Also create scope variable with that type: http://prntscr.com/89zyoy
And use ng-model for input component:
ng-model=myData.test

So your code have to be:
alert($scopemyData.test);

It will work: http://prntscr.com/89zxws


Angular / Accordion Scope

Posted: Fri Aug 28, 2015 8:35 pm
by Chris Ryhal

Awesome.