0

How'd I get the value to controller from a nested view? I'd like to mention that I have a recursive approach.

HTML

<textarea ng-model="inputValue" class="ng-valid ng-dirty ng-valid-parse ng-touched"></textarea>

Full HTML structure can be found here

Edit: I want to get the value of the textarea in my controller. (e.g. $scope.inputValue ); currently getting undefined

4
  • Could you clarify the question? What do you want? Commented Jan 15, 2015 at 13:03
  • what exactly you want to do? Commented Jan 15, 2015 at 13:36
  • I want to get the value of the textarea in my controller. (e.g. $scope.inputValue ); Commented Jan 15, 2015 at 13:56
  • This is just the HTML structure AFTER rendering by Angular. To understand the problem it would be far easier to have a working plunkr with the javascript files including the directives. Having said this, if you are using recursive or nested templates from directives you might want to look into these two pages stackoverflow.com/questions/22346373/… sporto.github.io/blog/2013/06/24/… Commented Jan 15, 2015 at 16:36

1 Answer 1

1

see this jszfiddle http://jsfiddle.net/7qbucc62/

 <div ng-app="app">
    <div ng-controller="firstController">
        <textarea ng-model="inputValue"></textarea>
        <textarea ng-model="inputValue"></textarea>
    </div>
</div>
<script>
    (function abc()
    {
        var app=angular.module("app",[]);
        app.controller("firstController",function($scope)
        {
            $scope.inputValue="";

        });
    })();
</script>

I think this is what you are asking

you can use $scope.inputValue directly in your controller. It will provide you the value of textarea

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

Comments

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.