1

I have the following markup. The function isn't called when you click on the icon and there are no errors logged to the console.

Online search hasn't shown others with this issue, so either it's a feature of the 'input append' markup or I've got something basic wrong that I'm just not seeing.

I'm using bootstrap 2.3 and angularjs 1.2.13

<div class="input-append input-block-level">

  <input type="text" name="myFieldName" ng-model="model[field]" 
    class="input-block-level ng-pristine ng-valid ng-valid-required" 
    placeholder="My Field Name" ng-required="false">

  <a class="btn add-on" ng-click="aCtrlFunc('my field name')">           
    <i class="icon-search"></i>
  </a>

</div>  

The form works, the model is updated as expected when typing into the field and on form submit. Why doesn't this button click work?

update

Mystery solved. It's a scope issue, like this one: https://stackoverflow.com/a/16489532/149060

The form fields are generated by a directive who's templates include ngRepeats. I didn't think of it because I didn't think it was using an isolate scope.

Community
  • 1
  • 1
Pauli Price
  • 4,187
  • 3
  • 34
  • 62
  • if you want to execute some javascript, why dont you add it to a function in controller, I guess we cannot write javascript directly on ng-click, it looks for angular related stuff inside it – Vamshi May 24 '14 at 04:11
  • I actually had a controller function there originally. I'll edit my question to make that clear, thanks. – Pauli Price May 24 '14 at 04:14

0 Answers0