Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Logical operators return incorrect results when used on forgiving expressions. #12099

Closed
@georeith

Description

@georeith

Version: 1.4.0-rc.2

Given the following statements:

  • scope.$eval("true && does.not.exist");
  • scope.$eval("true && !does.not.exist");

Both return true, as long as does.not is not an object on the current scope.

However scope.$eval("true && doesnotexist"); and scope.$eval("true && undefined"); both return false as expected as long as doesnotexist is not a truthy value on the current scope.

This makes me think it has something to do with using scope.$parse as it only occurs when attempting to access nested properties of undefined values on the scope which scope.$parse suppresses errors for.

For this reason any directive such as ng-if and ng-switch. For examples see: http://jsbin.com/muqaviwesu/1/edit?html,js,output

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions