Question: I have the following code:

```
<input id="id">
<button data-action="bea" ng-click="Create($('#id1')[0].value);" class="btn">Insert ID</button>
<button data-action="bea" ng-click="Create($('#id2')[0].value);" class="btn">Insert ID</button>

```

In the JS I have:

```
$scope.Create = function (id){
        if (id === undefined) {
            $scope.data = "You must specify an id";
        } else {
                $scope.data = data;
                console.log(data);
            });
        }
    };

```

When the call gets into the Create function the value of the id is undefined.

If I add the following line at the beginging of the Create function everything works ok:

```
id = $('#id')[0].value;

```

If I send a constant value it works:

```
<button data-action="bea" ng-click="Create('SomeID');" class="btn">Insert ID</button>

```

Why is this happening and how can I do that without putting the line of value into the method?

Thanks

Answer: 
This is not the way you should do in AngularJS. You should really think in Angular if you want to use AngularJS. Refer this post (["Thinking in AngularJS" if I have a jQuery background?](https://stackoverflow.com/questions/14994391/how-do-i-think-in-angularjs-if-i-have-a-jquery-background))

All DOM manipulation should be done in Directive. Refer this page that I found really clear. 
(<http://ng-learn.org/2014/01/Dom-Manipulations/>)
The JavaScript you are trying to pass as a parameter of the create function is not available in the scope of the Create function.

Try to target the element a different way.

Does that help?