0

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!

2
  • did you mean ng-model ? Commented Aug 25, 2014 at 19:12
  • This question appears to be off-topic because it is about a simple typographical error. Commented Aug 25, 2014 at 19:14

1 Answer 1

3

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">
Sign up to request clarification or add additional context in comments.

1 Comment

Happens to the best of us =D

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.