Scope of variable defined with ng-init restricted when using ng-if

Hello.

I am a bit perplex… I am trying to initialize some variables with ng-init in a div, but realize that they keep their values (or not) outside of the Div depending on the use (or not) of a ng-if directive…

Example:

<div ng-init="var1 = { value : 'XXX' }" ng-if="true">
  <div>var1 in: {{var1.value}}</div>
</div>
<div>var1 out: {{var1.value}}</div>

<div ng-init="var2 = { value : 'XXX' }">
  <div>var2 in: {{var2.value}}</div>
</div>
<div>var2 out: {{var2.value}}</div>

The display is:

var1 in: XXX
var1 out:
var2 in: XXX
var2 out: XXX

How could I initialize a variable based on a condition but without limiting its scope ?
(The only solution so far is to do this initialization properly in a js controller, but it’s less straightforward)…

V.