Chris Ryhal
Posts: 0
Joined: Fri Aug 15, 2014 1:09 pm

Angular / Accordion Scope

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.

Serhii Kulibaba
Posts: 150
Joined: Tue Aug 27, 2013 1:47 pm

Angular / Accordion Scope

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

Chris Ryhal
Posts: 0
Joined: Fri Aug 15, 2014 1:09 pm

Angular / Accordion Scope

Awesome.

Return to “Issues”