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?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
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

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.
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?
Big Business Goals? Which KPIs Will Help You

The most successful MSPs rely on metrics – known as key performance indicators (KPIs) – for making informed decisions that help their businesses thrive, rather than just survive. This eBook provides an overview of the most important KPIs used by top MSPs.

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.
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?

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.
Seven priceFull StackAuthor Commented:
tk
Julian HansenCommented:
You are welcome.
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.