Join the Stack Overflow Community
Stack Overflow is a community of 4.7 million programmers, just like you, helping each other.
Join them; it only takes a minute:
Sign up

I am setting up a temporary array to let users try and edit a few things and I'm trying to save a text input value to the arrary. The current method I am using is pushing something but it's showing up as a blank. I'm thinking I am not really getting the value from the text input correctly, have a look and see-

Here's the button and input

<input type="text" ng-module="tagName"><button type="button" class="resultsButton" ng-click="addTag()">Submit</button>

In my controller -

 $scope.tagsFeed = ["one", "two", "thre", "four", "five", "six"];

//ignore delete function
            $scope.deleteTag = function($index){
                $scope.tagsFeed.splice($index,1);
            };

            $scope.addTag = function(){

                $scope.tagsFeed.push($scope.tagName);
            };

My add tag function however does not seem to be working correctly. Pushing the button adds a blank entry to the array, I tried to console.log $scope.tagName and it seems to come abck as undefined. Any thoughts? Thanks!

share|improve this question
    
did you mean ng-model ? – PSL Aug 25 '14 at 19:12
    
This question appears to be off-topic because it is about a simple typographical error. – PSL Aug 25 '14 at 19:14
up vote 3 down vote accepted

Think you want ng-model instead of ng-module.

So change

<input type="text" ng-module="tagName">

To this:

<input type="text" ng-model="tagName">
share|improve this answer
1  
oh my goodness I can't believe i missed that. Thank you!! – ajmajmajma Aug 25 '14 at 19:13
    
Happens to the best of us =D – Dan-Nolan Aug 25 '14 at 19:14

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.