aboutsummaryrefslogtreecommitdiffstats
path: root/src/service
diff options
context:
space:
mode:
authorMisko Hevery2011-12-14 02:55:31 +0100
committerMisko Hevery2012-01-25 11:53:59 -0800
commit4804c83b7db5770d5d02eea9eea4cc012b4aa524 (patch)
treebe5ae1743179704cc1638f186cddba8d6e3fa37d /src/service
parente2b1d9e994e50bcd01d237302a3357bc7ebb6fa5 (diff)
downloadangular.js-4804c83b7db5770d5d02eea9eea4cc012b4aa524.tar.bz2
docs(compiler): update the compiler docs
Diffstat (limited to 'src/service')
-rw-r--r--src/service/compiler.js6
-rw-r--r--src/service/formFactory.js17
-rw-r--r--src/service/http.js10
-rw-r--r--src/service/route.js6
-rw-r--r--src/service/sanitize.js4
-rw-r--r--src/service/scope.js7
6 files changed, 26 insertions, 24 deletions
diff --git a/src/service/compiler.js b/src/service/compiler.js
index c663baac..acfc7851 100644
--- a/src/service/compiler.js
+++ b/src/service/compiler.js
@@ -49,9 +49,9 @@
})
});
- function Ctrl() {
- this.name = 'Angular';
- this.html = 'Hello {{name}}';
+ function Ctrl($scope) {
+ $scope.name = 'Angular';
+ $scope.html = 'Hello {{name}}';
}
</script>
<div ng-controller="Ctrl">
diff --git a/src/service/formFactory.js b/src/service/formFactory.js
index 727a243c..807f4113 100644
--- a/src/service/formFactory.js
+++ b/src/service/formFactory.js
@@ -22,26 +22,27 @@
* This example shows how one could write a widget which would enable data-binding on
* `contenteditable` feature of HTML.
*
- <doc:example>
+ <doc:example module="formModule">
<doc:source>
<script>
function EditorCntl($scope) {
- $scope.html = '<b>Hello</b> <i>World</i>!';
+ $scope.htmlContent = '<b>Hello</b> <i>World</i>!';
}
- HTMLEditorWidget.$inject = ['$element', '$scope', 'htmlFilter'];
- function HTMLEditorWidget(element, scope, htmlFilter) {
+ HTMLEditorWidget.$inject = ['$scope', '$element', '$sanitize'];
+ function HTMLEditorWidget(scope, element, $sanitize) {
scope.$parseModel = function() {
// need to protect for script injection
try {
- this.$viewValue = htmlFilter(this.$modelValue || '').get();
+ scope.$viewValue = $sanitize(
+ scope.$modelValue || '');
if (this.$error.HTML) {
// we were invalid, but now we are OK.
- this.$emit('$valid', 'HTML');
+ scope.$emit('$valid', 'HTML');
}
} catch (e) {
// if HTML not parsable invalidate form.
- this.$emit('$invalid', 'HTML');
+ scope.$emit('$invalid', 'HTML');
}
}
@@ -128,7 +129,7 @@ function $FormFactoryProvider() {
* Static method on `$formFactory` service.
*
* Retrieve the closest form for a given element or defaults to the `root` form. Used by the
- * {@link angular.widget.form form} element.
+ * {@link angular.module.ng.$compileProvider.directive.form form} element.
* @param {Element} element The element where the search for form should initiate.
*/
formFactory.forElement = function(element) {
diff --git a/src/service/http.js b/src/service/http.js
index 9d57ed76..93d44eac 100644
--- a/src/service/http.js
+++ b/src/service/http.js
@@ -438,14 +438,14 @@ function $HttpProvider() {
it('should make an xhr GET request', function() {
element(':button:contains("Sample GET")').click();
element(':button:contains("fetch")').click();
- expect(binding('status')).toBe('http status code: 200');
- expect(binding('data')).toBe('http response data: Hello, $http!\n');
+ expect(binding('status')).toBe('200');
+ expect(binding('data')).toBe('Hello, $http!\n');
});
it('should make a JSONP request to angularjs.org', function() {
element(':button:contains("Sample JSONP")').click();
element(':button:contains("fetch")').click();
- expect(binding('status')).toBe('http status code: 200');
+ expect(binding('status')).toBe('200');
expect(binding('data')).toMatch(/Super Hero!/);
});
@@ -453,8 +453,8 @@ function $HttpProvider() {
function() {
element(':button:contains("Invalid JSONP")').click();
element(':button:contains("fetch")').click();
- expect(binding('status')).toBe('http status code: 0');
- expect(binding('data')).toBe('http response data: Request failed');
+ expect(binding('status')).toBe('0');
+ expect(binding('data')).toBe('Request failed');
});
</doc:scenario>
</doc:example>
diff --git a/src/service/route.js b/src/service/route.js
index f8200fd4..9b52c4b0 100644
--- a/src/service/route.js
+++ b/src/service/route.js
@@ -13,7 +13,7 @@
* Watches `$location.url()` and tries to map the path to an existing route
* definition. It is used for deep-linking URLs to controllers and views (HTML partials).
*
- * The `$route` service is typically used in conjunction with {@link angular.widget.ng:view ng:view}
+ * The `$route` service is typically used in conjunction with {@link angular.module.ng.$compileProvider.directive.ng:view ng:view}
* widget and the {@link angular.module.ng.$routeParams $routeParams} service.
*
* @example
@@ -150,8 +150,8 @@ function $RouteProvider(){
* - `controller` – `{function()=}` – Controller fn that should be associated with newly
* created scope.
* - `template` – `{string=}` – path to an html template that should be used by
- * {@link angular.widget.ng:view ng:view} or
- * {@link angular.widget.ng:include ng:include} widgets.
+ * {@link angular.module.ng.$compileProvider.directive.ng:view ng:view} or
+ * {@link angular.module.ng.$compileProvider.directive.ng:include ng:include} widgets.
* - `redirectTo` – {(string|function())=} – value to update
* {@link angular.module.ng.$location $location} path with and trigger route redirection.
*
diff --git a/src/service/sanitize.js b/src/service/sanitize.js
index 0d5c74af..1e201691 100644
--- a/src/service/sanitize.js
+++ b/src/service/sanitize.js
@@ -37,8 +37,8 @@
<doc:example>
<doc:source>
<script>
- function Ctrl() {
- this.snippet =
+ function Ctrl($scope) {
+ $scope.snippet =
'<p style="color:blue">an html\n' +
'<em onmouseover="this.textContent=\'PWN3D!\'">click here</em>\n' +
'snippet</p>';
diff --git a/src/service/scope.js b/src/service/scope.js
index f59417bc..4abf96f1 100644
--- a/src/service/scope.js
+++ b/src/service/scope.js
@@ -277,9 +277,10 @@ function $RootScopeProvider(){
* `'Maximum iteration limit exceeded.'` if the number of iterations exceeds 100.
*
* Usually you don't call `$digest()` directly in
- * {@link angular.directive.ng:controller controllers} or in {@link angular.directive directives}.
+ * {@link angular.module.ng.$compileProvider.directive.ng:controller controllers} or in
+ * {@link angular.module.ng.$compileProvider.directive directives}.
* Instead a call to {@link angular.module.ng.$rootScope.Scope#$apply $apply()} (typically from within a
- * {@link angular.directive directive}) will force a `$digest()`.
+ * {@link angular.module.ng.$compileProvider.directive directives}) will force a `$digest()`.
*
* If you want to be notified whenever `$digest()` is called,
* you can register a `watchExpression` function with {@link angular.module.ng.$rootScope.Scope#$watch $watch()}
@@ -396,7 +397,7 @@ function $RootScopeProvider(){
* The destructing scope emits an `$destroy` {@link angular.module.ng.$rootScope.Scope#$emit event}.
*
* The `$destroy()` is usually used by directives such as
- * {@link angular.widget.@ng:repeat ng:repeat} for managing the unrolling of the loop.
+ * {@link angular.module.ng.$compileProvider.directive.ng:repeat ng:repeat} for managing the unrolling of the loop.
*
*/
$destroy: function() {