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.

Docs should be consistent with respect to guidance on use of ng-init #10489

Closed
@fredsa

Description

@fredsa

The ng-init docs state:

The only appropriate use of ngInit is for aliasing special properties of
{@link ng.directive:ngRepeat ngRepeat}, as seen in the demo below. Besides this case, you
should use {@link guide/controller controllers} rather than ngInit
to initialize values on a scope.

However, some of the docs' own examples (e.g. ng-mousenter) explicitly use ng-init in a way which violates the above guidance.

For example, ng-mouseenter contains this example:

   <example>
     <file name="index.html">
      <button ng-mouseenter="count = count + 1" ng-init="count=0">
        Increment (when mouse enters)
      </button>
      count: {{count}}
     </file>
   </example>

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions