0

My code is:

<div ng-controller="myCtrl">
    <div class="row">
        <div class="col-md-4 col-sm-3">
            <checked-input ng-scope="$eventID"></checked-input>
        </div>
        <div class="col-md-4 col-sm-3">
            <output ng-scope="$postbackOutput">***This is where I want the text typed in the textbox to go***</output>
        </div>
        <div class="col-md-3 col-sm-3">
            <a ng-click="generateURL($eventID)" class="btn-plus">
                <span class="glyphicon glyphicon-plus"></span>
            </a>
        </div>
     </div>
</div>

So what I'm trying to do is get that $eventID that's inside the first column div, then pass it as an argument to the function call generateURL() when the link in the <a> tag is clicked in the third column. Inside the controller I have:

app.controller('postbackCtrl', function($scope) {
    $scope.generateURL = function(eventID) {
        $scope.postbackOutput = eventID;
    } 
});

But it doesn't seem to be setting the text in the <output> correctly. Could anyone help? I've just started out with angular so it's a bit confusing.

1 Answer 1

1

You can just bind the var to the view with handlebar brackets:

<output ng-scope="$postbackOutput">
    {{ postbackOutput }}
</output>

Here is a working plunkr

Sign up to request clarification or add additional context in comments.

2 Comments

Thanks for your reply. Tried it and it doesn't seem to be working either :(
I added a simple plunkr to show it working, I think it is what you are trying to accomplish. Also I just looked up the ng-scope directive and wonder if that might be messing with things

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.