Update Angular to 1.2.0 RC2
This commit is contained in:
parent
7416269494
commit
0d3a40980e
184 changed files with 17993 additions and 21133 deletions
|
@ -26,10 +26,10 @@ this.secondMethod = function() {
|
|||
myController.$inject = ['$location', '$log'];
|
||||
</pre>
|
||||
<h3>Source</h2>
|
||||
<div source-edit="MyServiceModule" source-edit-deps="angular.js script.js" source-edit-html="index.html-195" source-edit-css="" source-edit-js="script.js-194" source-edit-json="" source-edit-unit="" source-edit-scenario="scenario.js-196"></div>
|
||||
<div source-edit="MyServiceModule" source-edit-deps="angular.js script.js" source-edit-html="index.html-196" source-edit-css="" source-edit-js="script.js-195" source-edit-json="" source-edit-unit="" source-edit-scenario="scenario.js-197"></div>
|
||||
<div class="tabbable"><div class="tab-pane" title="index.html">
|
||||
<pre class="prettyprint linenums" ng-set-text="index.html-195" ng-html-wrap="MyServiceModule angular.js script.js"></pre>
|
||||
<script type="text/ng-template" id="index.html-195">
|
||||
<pre class="prettyprint linenums" ng-set-text="index.html-196" ng-html-wrap="MyServiceModule angular.js script.js"></pre>
|
||||
<script type="text/ng-template" id="index.html-196">
|
||||
|
||||
|
||||
<div ng-controller="myController">
|
||||
|
@ -41,8 +41,8 @@ myController.$inject = ['$location', '$log'];
|
|||
</script>
|
||||
</div>
|
||||
<div class="tab-pane" title="script.js">
|
||||
<pre class="prettyprint linenums" ng-set-text="script.js-194"></pre>
|
||||
<script type="text/ng-template" id="script.js-194">
|
||||
<pre class="prettyprint linenums" ng-set-text="script.js-195"></pre>
|
||||
<script type="text/ng-template" id="script.js-195">
|
||||
angular.
|
||||
module('MyServiceModule', []).
|
||||
factory('notify', ['$window', function(win) {
|
||||
|
@ -66,24 +66,24 @@ myController.$inject = ['$scope','notify'];
|
|||
</script>
|
||||
</div>
|
||||
<div class="tab-pane" title="End to end test">
|
||||
<pre class="prettyprint linenums" ng-set-text="scenario.js-196"></pre>
|
||||
<script type="text/ng-template" id="scenario.js-196">
|
||||
<pre class="prettyprint linenums" ng-set-text="scenario.js-197"></pre>
|
||||
<script type="text/ng-template" id="scenario.js-197">
|
||||
it('should test service', function() {
|
||||
expect(element(':input[ng\\:model="message"]').val()).toEqual('test');
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
</div><h2>Demo</h2>
|
||||
<div class="well doc-example-live animate-container" ng-embed-app="MyServiceModule" ng-set-html="index.html-195" ng-eval-javascript="script.js-194"></div>
|
||||
<div class="well doc-example-live animate-container" ng-embed-app="MyServiceModule" ng-set-html="index.html-196" ng-eval-javascript="script.js-195"></div>
|
||||
<h2>Implicit Dependency Injection</h2>
|
||||
<p>A new feature of Angular DI allows it to determine the dependency from the name of the parameter.
|
||||
Let's rewrite the above example to show the use of this implicit dependency injection of
|
||||
<code>$window</code>, <code>$scope</code>, and our <code>notify</code> service:</p>
|
||||
<h2>Source</h2>
|
||||
<div source-edit="MyServiceModuleDI" source-edit-deps="angular.js script.js" source-edit-html="index.html-198" source-edit-css="" source-edit-js="script.js-197" source-edit-json="" source-edit-unit="" source-edit-scenario=""></div>
|
||||
<div source-edit="MyServiceModuleDI" source-edit-deps="angular.js script.js" source-edit-html="index.html-199" source-edit-css="" source-edit-js="script.js-198" source-edit-json="" source-edit-unit="" source-edit-scenario=""></div>
|
||||
<div class="tabbable"><div class="tab-pane" title="index.html">
|
||||
<pre class="prettyprint linenums" ng-set-text="index.html-198" ng-html-wrap="MyServiceModuleDI angular.js script.js"></pre>
|
||||
<script type="text/ng-template" id="index.html-198">
|
||||
<pre class="prettyprint linenums" ng-set-text="index.html-199" ng-html-wrap="MyServiceModuleDI angular.js script.js"></pre>
|
||||
<script type="text/ng-template" id="index.html-199">
|
||||
|
||||
<div ng-controller="myController">
|
||||
<p>Let's try the notify service, that is implicitly injected into the controller...</p>
|
||||
|
@ -94,8 +94,8 @@ Let's rewrite the above example to show the use of this implicit dependency
|
|||
</script>
|
||||
</div>
|
||||
<div class="tab-pane" title="script.js">
|
||||
<pre class="prettyprint linenums" ng-set-text="script.js-197"></pre>
|
||||
<script type="text/ng-template" id="script.js-197">
|
||||
<pre class="prettyprint linenums" ng-set-text="script.js-198"></pre>
|
||||
<script type="text/ng-template" id="script.js-198">
|
||||
angular.
|
||||
module('MyServiceModuleDI', []).
|
||||
factory('notify', function($window) {
|
||||
|
@ -117,7 +117,7 @@ function myController($scope, notify) {
|
|||
</script>
|
||||
</div>
|
||||
</div><h2>Demo</h2>
|
||||
<div class="well doc-example-live animate-container" ng-embed-app="MyServiceModuleDI" ng-set-html="index.html-198" ng-eval-javascript="script.js-197"></div>
|
||||
<div class="well doc-example-live animate-container" ng-embed-app="MyServiceModuleDI" ng-set-html="index.html-199" ng-eval-javascript="script.js-198"></div>
|
||||
<p>However, if you plan to <a href="http://en.wikipedia.org/wiki/Minification_(programming)">minify</a> your
|
||||
code, your variable names will get renamed in which case you will still need to explicitly specify
|
||||
dependencies with the <code>$inject</code> property.</p>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue