UNPKG

knowhow-server

Version:

A personal workflow engine that can manage and use any network connected host

53 lines (52 loc) 4.52 kB
<a href="http://github.com/angular/angular.js/tree/v1.2.9/src/ng/parse.js#L1126" class="view-source btn btn-action"><i class="icon-zoom-in"> </i> View source</a><a href="http://github.com/angular/angular.js/edit/master/src/ng/parse.js" class="improve-docs btn btn-primary"><i class="icon-edit"> </i> Improve this doc</a><h1><code ng:non-bindable="">$parseProvider</code> <div><span class="hint">service in module <code ng:non-bindable="">ng</code> </span> </div> </h1> <div><h2 id="description">Description</h2> <div class="description"><div class="ng-parseprovider-page"><p><code>$parseProvider</code> can be used for configuring the default behavior of the <a href="api/ng.$parse"><code>$parse</code></a> service.</p> </div></div> <div class="member method"><h2 id="methods">Methods</h2> <ul class="methods"><li><h3 id="methods_logpromisewarnings">logPromiseWarnings(value)</h3> <div class="logpromisewarnings"><div class="ng-parseprovider-logpromisewarnings-page"><p>Controls whether Angular should log a warning on any encounter of a promise in an expression.</p> <p>The default is set to <code>true</code>.</p> <p>This setting applies only if <code>$parseProvider.unwrapPromises</code> setting is set to true as well.</p> </div><h5 id="methods_logpromisewarnings_parameters">Parameters</h5><table class="variables-matrix table table-bordered table-striped"><thead><tr><th>Param</th><th>Type</th><th>Details</th></tr></thead><tbody><tr><td>value <div><em>(optional)</em></div></td><td><a href="" class="label type-hint type-hint-boolean">boolean</a></td><td><div class="ng-parseprovider-logpromisewarnings-page"><p>New value.</p> </div></td></tr></tbody></table><h5 id="methods_logpromisewarnings_returns">Returns</h5><table class="variables-matrix"><tr><td><a href="" class="label type-hint type-hint-boolean">boolean|self</a></td><td><div class="ng-parseprovider-logpromisewarnings-page"><p>Returns the current setting when used as getter and self if used as setter.</p> </div></td></tr></table></div> </li> <li><h3 id="methods_unwrappromises">unwrapPromises(value)</h3> <div class="unwrappromises"><div class="ng-parseprovider-unwrappromises-page"><p><strong>This feature is deprecated, see deprecation notes below for more info</strong></p> <p>If set to true (default is false), $parse will unwrap promises automatically when a promise is found at any part of the expression. In other words, if set to true, the expression will always result in a non-promise value.</p> <p>While the promise is unresolved, it&#39;s treated as undefined, but once resolved and fulfilled, the fulfillment value is used in place of the promise while evaluating the expression.</p> <p><strong>Deprecation notice</strong></p> <p>This is a feature that didn&#39;t prove to be wildly useful or popular, primarily because of the dichotomy between data access in templates (accessed as raw values) and controller code (accessed as promises).</p> <p>In most code we ended up resolving promises manually in controllers anyway and thus unifying the model access there.</p> <p>Other downsides of automatic promise unwrapping:</p> <ul> <li>when building components it&#39;s often desirable to receive the raw promises</li> <li>adds complexity and slows down expression evaluation</li> <li>makes expression code pre-generation unattractive due to the amount of code that needs to be generated</li> <li>makes IDE auto-completion and tool support hard</li> </ul> <p><strong>Warning Logs</strong></p> <p>If the unwrapping is enabled, Angular will log a warning about each expression that unwraps a promise (to reduce the noise, each expression is logged only once). To disable this logging use <code>$parseProvider.logPromiseWarnings(false)</code> api.</p> </div><h5 id="methods_unwrappromises_parameters">Parameters</h5><table class="variables-matrix table table-bordered table-striped"><thead><tr><th>Param</th><th>Type</th><th>Details</th></tr></thead><tbody><tr><td>value <div><em>(optional)</em></div></td><td><a href="" class="label type-hint type-hint-boolean">boolean</a></td><td><div class="ng-parseprovider-unwrappromises-page"><p>New value.</p> </div></td></tr></tbody></table><h5 id="methods_unwrappromises_returns">Returns</h5><table class="variables-matrix"><tr><td><a href="" class="label type-hint type-hint-boolean">boolean|self</a></td><td><div class="ng-parseprovider-unwrappromises-page"><p>Returns the current setting when used as getter and self if used as setter.</p> </div></td></tr></table></div> </li> </ul> </div> </div>