docs(ngBind): update examples to use modules

This commit is contained in:
Brian Ford
2014-07-07 23:06:11 -07:00
parent 28310583a9
commit 1bce5bb3bb

View File

@@ -26,14 +26,15 @@
*
* @example
* Enter a name in the Live Preview text box; the greeting below the text box changes instantly.
<example>
<example module="bindExample">
<file name="index.html">
<script>
function Ctrl($scope) {
$scope.name = 'Whirled';
}
angular.module('bindExample', [])
.controller('ExampleController', ['$scope', function($scope) {
$scope.name = 'Whirled';
}]);
</script>
<div ng-controller="Ctrl">
<div ng-controller="ExampleController">
Enter name: <input type="text" ng-model="name"><br>
Hello <span ng-bind="name"></span>!
</div>
@@ -84,15 +85,16 @@ var ngBindDirective = ngDirective({
*
* @example
* Try it here: enter text in text box and watch the greeting change.
<example>
<example module="bindExample">
<file name="index.html">
<script>
function Ctrl($scope) {
$scope.salutation = 'Hello';
$scope.name = 'World';
}
angular.module('bindExample', [])
.controller('ExampleController', ['$scope', function ($scope) {
$scope.salutation = 'Hello';
$scope.name = 'World';
}]);
</script>
<div ng-controller="Ctrl">
<div ng-controller="ExampleController">
Salutation: <input type="text" ng-model="salutation"><br>
Name: <input type="text" ng-model="name"><br>
<pre ng-bind-template="{{salutation}} {{name}}!"></pre>
@@ -150,20 +152,20 @@ var ngBindTemplateDirective = ['$interpolate', function($interpolate) {
* @example
Try it here: enter text in text box and watch the greeting change.
<example module="ngBindHtmlExample" deps="angular-sanitize.js">
<example module="bindHtmlExample" deps="angular-sanitize.js">
<file name="index.html">
<div ng-controller="ngBindHtmlCtrl">
<div ng-controller="ExampleController">
<p ng-bind-html="myHTML"></p>
</div>
</file>
<file name="script.js">
angular.module('ngBindHtmlExample', ['ngSanitize'])
.controller('ngBindHtmlCtrl', ['$scope', function ngBindHtmlCtrl($scope) {
$scope.myHTML =
'I am an <code>HTML</code>string with <a href="#">links!</a> and other <em>stuff</em>';
}]);
angular.module('bindHtmlExample', ['ngSanitize'])
.controller('ExampleController', ['$scope', function($scope) {
$scope.myHTML =
'I am an <code>HTML</code>string with ' +
'<a href="#">links!</a> and other <em>stuff</em>';
}]);
</file>
<file name="protractor.js" type="protractor">