Can't access form on $scope

I think the problem has to do with how Angular creates a new scope for directives that request an isolated scope. I was able to get this to work if I initialize my scope variable as an object:

.controller('testController', function($scope) {
    // This will not be updated
    $scope.testVar = '';

    // This will be updated
    $scope.otherTestVar = { value: '' };
});

Because <content> is a directive with an isolated scope, it will lose the reference to $scope.testVar but not $scope.otherTestVar because it is an object.

Here is my test HTML:

<content>
    <input type="text" ng-model="testVar" />
    <input type="text" ng-model="otherTestVar.value" />
</content>

@max Is this something you guys can handle, or is this Angular specific?

4 Likes