<div ng-app="MyApp" ng-controller="MyCtrl"> <div> <label>Write here first (the variable will be shared among the two inputs):</label> <input ng-model="obj.prop" type="text" /><br /> </div> <div ng-if="true"> <label>Write here first (the two input boxes will live indipendently):</label> <input ng-model="obj.prop" type="text" /><br /> </div> <a href="#" ng-click="reset()">Reload the demo!</a> </div>
angular.module('MyApp', []).controller('MyCtrl', function ($scope) { $scope.reset = function() { window.location.reload(); }; });