|
8 | 8 | * @kind function
|
9 | 9 | *
|
10 | 10 | * @description
|
11 |
| - * Finds links in text input and turns them into html links. Supports http/https/ftp/mailto and |
| 11 | + * Finds links in text input and turns them into html links. Supports `http/https/ftp/mailto` and |
12 | 12 | * plain email address links.
|
13 | 13 | *
|
14 | 14 | * Requires the {@link ngSanitize `ngSanitize`} module to be installed.
|
15 | 15 | *
|
16 | 16 | * @param {string} text Input text.
|
17 |
| - * @param {string} target Window (_blank|_self|_parent|_top) or named frame to open links in. |
| 17 | + * @param {string} target Window (`_blank|_self|_parent|_top`) or named frame to open links in. |
18 | 18 | * @param {object|function(url)} [attributes] Add custom attributes to the link element.
|
19 | 19 | *
|
20 | 20 | * Can be one of:
|
|
25 | 25 | * If the map of attributes contains a value for `target`, it overrides the value of
|
26 | 26 | * the target parameter.
|
27 | 27 | *
|
28 |
| - * @returns {string} Html-linkified text. |
| 28 | + * |
| 29 | + * @returns {string} Html-linkified and {@link $sanitize sanitized} text. |
29 | 30 | *
|
30 | 31 | * @usage
|
31 | 32 | <span ng-bind-html="linky_expression | linky"></span>
|
32 | 33 | *
|
33 | 34 | * @example
|
34 | 35 | <example module="linkyExample" deps="angular-sanitize.js">
|
35 | 36 | <file name="index.html">
|
36 |
| - <script> |
37 |
| - angular.module('linkyExample', ['ngSanitize']) |
38 |
| - .controller('ExampleController', ['$scope', function($scope) { |
39 |
| - $scope.snippet = |
40 |
| - 'Pretty text with some links:\n'+ |
41 |
| - 'http://angularjs.org/,\n'+ |
42 |
| - 'mailto:us@somewhere.org,\n'+ |
43 |
| - |
44 |
| - 'and one more: ftp://127.0.0.1/.'; |
45 |
| - $scope.snippetWithSingleURL = 'http://angularjs.org/'; |
46 |
| - }]); |
47 |
| - </script> |
48 | 37 | <div ng-controller="ExampleController">
|
49 | 38 | Snippet: <textarea ng-model="snippet" cols="60" rows="3"></textarea>
|
50 | 39 | <table>
|
51 | 40 | <tr>
|
52 |
| - <td>Filter</td> |
53 |
| - <td>Source</td> |
54 |
| - <td>Rendered</td> |
| 41 | + <th>Filter</th> |
| 42 | + <th>Source</th> |
| 43 | + <th>Rendered</th> |
55 | 44 | </tr>
|
56 | 45 | <tr id="linky-filter">
|
57 | 46 | <td>linky filter</td>
|
|
87 | 76 | </tr>
|
88 | 77 | </table>
|
89 | 78 | </file>
|
| 79 | + <file name="script.js"> |
| 80 | + angular.module('linkyExample', ['ngSanitize']) |
| 81 | + .controller('ExampleController', ['$scope', function($scope) { |
| 82 | + $scope.snippet = |
| 83 | + 'Pretty text with some links:\n'+ |
| 84 | + 'http://angularjs.org/,\n'+ |
| 85 | + 'mailto:us@somewhere.org,\n'+ |
| 86 | + |
| 87 | + 'and one more: ftp://127.0.0.1/.'; |
| 88 | + $scope.snippetWithSingleURL = 'http://angularjs.org/'; |
| 89 | + }]); |
| 90 | + </file> |
90 | 91 | <file name="protractor.js" type="protractor">
|
91 | 92 | it('should linkify the snippet with urls', function() {
|
92 | 93 | expect(element(by.id('linky-filter')).element(by.binding('snippet | linky')).getText()).
|
|
0 commit comments