0

thanks for the help. Sentence1: hello this is java , on click of it it should change to Sentence2: Hello this is not java.

can anyone give me a good solution for this , I have a input tag and check box and there ng-change is working fine , but I want the same logic with text change.

<div ng-model="form.app" ng-change="updating()" >  
<input ng-model="form.app" ng-change="updating()" type="checkbox">
georgeawg
  • 48,608
  • 13
  • 72
  • 95
pandu
  • 23
  • 4
  • 1
    The `ng-model` and `ng-change` directives do not work with `
    ` elements.
    – georgeawg Apr 27 '18 at 19:31
  • then how to achieve this ? I need to change the text from yes to no on click . and when I'm replacing ng-change with ng-click I'm not able to achieve my logic. – pandu Apr 27 '18 at 20:06

1 Answers1

0

I need to change the text from yes to no on click.

Use AngularJS expressions:

<script src="//unpkg.com/angular/angular.js"></script>
<body ng-app>
    <input ng-model="form.app" type="checkbox">{{form.app}}
    <div>Hello, this is {{!form.app?'not':''}} Java</div>
</body>

For more information, see AngularJS Developer Guide - Interpplation and data-binding.

georgeawg
  • 48,608
  • 13
  • 72
  • 95
  • I don't want a checkbox like that , I want to click directly on the text itself and make it change. – pandu Apr 27 '18 at 20:24