m7r/grunt-ngdocs — pull request #110 by jacksonrayhamilton (2014-09-15 23:04:23+00:00)
Title: Fix bug where DOM is parsed too late.

When using `@link` in the following manner...

```javascript
/**
* {@link sc.widgets.poll.scPoller#methods_create create}
*/
```

...the `checkBrokenLinks` function is called too early.

The following logic...

```javascript
} else if (anchorLink && linkedPage.anchors.indexOf(anchorLink) === -1) {
console.log('WARNING: ' + doc.section + '/' + doc.id + ' (defined in ' + doc.file + ') points to a non existing anchor "' + link + '"!');
}
```

...executes before the DOM has been parsed. `linkedPage.anchors` is always `['directive', 'service', 'filter', 'function']`. When an anchor such as `#methods_create` is checked-for, it is never in `linkedPage.anchors`, and a warning is incorrectly output.

Moving the invocation of the `checkBrokenLinks` function after the call to `Doc#html` populates the `linkedPage.anchors` in-time, fixing this issue.