If else in ionic


can I use if else condition in ionic to compare a string that I entered to the input type with another string


If you have read on Ionic … you might have figured out that Ionic uses AngularJS wich is a Javascript framework. And javascript has if else :slight_smile:


of course you can, but this is not ionic specific, it’s more an angular/javascript specific problem. In your controller try something like this:

$scope.$watch("myInputName", function(newValue) {
//the selection comes here:
if(newValue === 'myCompareString') {
//do anything you want