In this example last name textbox will be created if ng-if expression evaluates true i.e first name textbox neither be null nor empty. In our example, we have two textboxes one with ng-model="firstName" and second with ng-model="lastName", but there is span outside lastname textbox with ng-if="firstName!=null && firstName!=''" so if there will be any value in first textbox only then the second textbox will be visible.

<!DOCTYPE html> <html xmlns=""> <head> <title>Welcome to LearnKode - A code learning platform</title> <script src=""></script> </head> <body ng-app> <div> First Name <input type="text" ng-model="firstName" /> <span ng-if="firstName!=null && firstName!=''"> Last Name <input type="text" ng-model="lastName" /></span> </div> </body> </html>