0

When I hard code in the value I want to pass like this, it works and data is being returned correctly:

<!-- This works! --> 
ng-click="LSCC.getCrawlResults(4661224)"

However, when I try to save a value from a text box and pass that into my ng-click, I am getting errors.

<!-- This doesn't work! -->
<input class="form-control" name="retailerID" ng-model"x">

<button type="button" class="btn btn-default" ng-click="LSCC.getCrawlResults('x')">Load</button>

I have tried passing parameters in a variety of different ways, but I can't seem to figure out how to accomplish this. Thank you!

3 Answers 3

1

x is assign wrong in ng-model, and I guess it's necessary to remove the quotes.

<input class="form-control" name="retailerID" ng-model="x">

<button type="button" class="btn btn-default" ng-click="LSCC.getCrawlResults(x)">Load</button>
Sign up to request clarification or add additional context in comments.

1 Comment

I tried that and I'm getting this message: "Conversion failed when converting the nvarchar value 'undefined' to data type int." OUTPUT
1

Where is your ng-click function defined? In a controller? If so I would just attach everything to $scope and access the ng-model using $scope.x instead of trying to pass it in since that is giving you trouble

Comments

0

To answer my question, I forgot an '=' sign.

ng-model"x"  <!-- No '=' sign -->

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.