# "ng-click" Not working out of "ion-content"

**URL:** <https://forum.ionicframework.com/t/ng-click-not-working-out-of-ion-content/47503>\
**Category:** ionic-v1\
**Created:** [March 26, 2016, 10:29am UTC](https://forum.ionicframework.com/t/ng-click-not-working-out-of-ion-content/47503 "2016-03-26T10:29:00Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![vahidvdn](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/vahidvdn/32/94016_2.png) [@vahidvdn](https://forum.ionicframework.com/u/vahidvdn)\
**Post date:** [March 26, 2016, 10:29am UTC](https://forum.ionicframework.com/t/ng-click-not-working-out-of-ion-content/47503/1 "2016-03-26T10:29:00Z")

</div>

Hi there.  
I have an input box with ng-model attribute. Inside `ion-content` tag:

```
<ion-content class="padding">
  <input ng-model="myNumber" type="number" placeholder="Enter number">
</ion-content>

```

And in the **footer-bar** I have this:

```
<div class="bar bar-footer bar-balanced" style="background-color: #00368C !important; color: #fff;">
    <div class="title">
      <button ng-click="submit(myNumber)" class="button button-clear">Submit</button>
    </div>
</div>

```

The alert result is **undefined**.

**NOTE:** when I put the `button` inside the `ion-content` it works fine.  
Any idea?

---

<div class="post-metadata">

**Author:** ![rlouie](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/rlouie/32/134973_2.png) [@rlouie](https://forum.ionicframework.com/u/rlouie)\
**Post date:** [March 26, 2016, 2:36pm UTC](https://forum.ionicframework.com/t/ng-click-not-working-out-of-ion-content/47503/2 "2016-03-26T14:36:06Z")

</div>

This is how ion-content is designed to work, it gets it’s own child scope, see the docs: [http://ionicframework.com/docs/api/directive/ionContent/](http://ionicframework.com/docs/api/directive/ionContent/)

---

<div class="post-metadata">

**Author:** ![rlouie](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/rlouie/32/134973_2.png) [@rlouie](https://forum.ionicframework.com/u/rlouie)\
**Post date:** [March 26, 2016, 2:49pm UTC](https://forum.ionicframework.com/t/ng-click-not-working-out-of-ion-content/47503/3 "2016-03-26T14:49:41Z")

</div>

If you want to get around this declare an object in your controller and set the model to be a property of that object. That way the directives scope will change the value by reference and all will be well. Here’s a working example: [http://codepen.io/anon/pen/QNgvNx](http://codepen.io/anon/pen/QNgvNx)

---

<div class="post-metadata">

**Author:** ![vahidvdn](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/vahidvdn/32/94016_2.png) [@vahidvdn](https://forum.ionicframework.com/u/vahidvdn)\
**Post date:** [March 26, 2016, 3:57pm UTC](https://forum.ionicframework.com/t/ng-click-not-working-out-of-ion-content/47503/4 "2016-03-26T15:57:59Z")

</div>

@rloui Thank you so much.

---

<div class="post-metadata">

**Author:** ![rolinger](https://avatars.discourse-cdn.com/v4/letter/r/34f0e0/32.png) [@rolinger](https://forum.ionicframework.com/u/rolinger)\
**Post date:** [August 6, 2020, 11:00pm UTC](https://forum.ionicframework.com/t/ng-click-not-working-out-of-ion-content/47503/5 "2020-08-06T23:00:17Z")

</div>

Does this method work between controllers?

I need to have a div pinned to the top. But the buttons/inputs in that div need to pass data to another controller? Should I just use $rootScope variables in that case or is there another method?

Does Ionic v1 have a method to pin a div to the top of the screen - I see in other threads methods like `ion-fixed` but I think thats specific to Ionic 3x and higher. Not certain though. This would all be a lot easier if there was a v1 method to pin a div.

---

<div class="post-metadata">

**Author:** ![mhartington](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/mhartington/32/137757_2.png) [@mhartington](https://forum.ionicframework.com/u/mhartington)\
**Post date:** [July 19, 2021, 8:54pm UTC](https://forum.ionicframework.com/t/ng-click-not-working-out-of-ion-content/47503/6 "2021-07-19T20:54:18Z")

</div>


