AngularJS - ngModel in nested directives

Simple example for StackOverflow (http://stackoverflow.com/questions/19429958/passing-ng-model-in-nested-directives)

HTML

<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.1.5/angular.js"></script>
<div ng-app="MyApp" ng-controller="MyCtrl">
    <label> Type here first, and both will share their ng-model</label>
    <input ng-model="obj.prop" type="text" /><br />
    <div ng-if="true">
        <label>Type here first, and their ng-models will be distinct</label>
        <input ng-model="obj.prop" type="text" /><br />
    </div>

</div>

JavaScript

var myApp = angular.module('MyApp', []);

myApp.controller('MyCtrl', function ($scope) {
});