push array to select

http://jsfiddle.net/sevensnake/7n8NR/486/

trying to type into multiply text boxes and push the value to a select box. for some reason the array does not work.
LVL 9
Seven priceFull StackAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Julian HansenCommented:
The fiddle has the addItem commented out - uncommenting it gives some errors due to some closing bracket issues.

Fixing that so it looks like this (see below) yields a result but not sure what I am looking for?
function ($scope) {

    // Item List Arrays
    $scope.items = [];
  
    $scope.addItem = function () {
       $scope.items.push({
            itemtext: $scope.item,
            
      });
    
    // cannot get this to work.
     //   $scope.array.forEach(function (items) {
   // $scope.array.push({'item'});
};

Open in new window

0
Seven priceFull StackAuthor Commented:
http://jsfiddle.net/sevensnake/nvrwjd29/#base

well I want it to work without the button.   A user will type some text in the textbox. each text box will add what the user type in into a select dropdown.
0
Julian HansenCommented:
The trigger for this would be ?

You have two text boxes - what condition would signal the user is finished and the data should be added to the drop down?
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

Seven priceFull StackAuthor Commented:
the bigger picture there is no need the user will move on to another text box that is not associated. More in likely when the user is finished typeing in the textbox that will lead to being done.
0
Julian HansenCommented:
when the user is finished typeing in the textbox that will lead to being done.
Ok, but you have two text boxes? Is that how it is going to be
What if the user clicks out of a box by mistake - value is auto-added
Or if you have two boxes and they enter in the second one first?

Trying to understand why you would want the behaviour to be like that?
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Seven priceFull StackAuthor Commented:
Ok I made some changes. so I found a better way. but the question made me think.

Thanks.
0
Seven priceFull StackAuthor Commented:
tk
0
Julian HansenCommented:
You are welcome.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
JavaScript

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.