@@ -134,7 +134,16 @@ The following example demonstrates:
134134 save: function() {
135135 this.master = this.form;
136136 this.cancel();
137+ },
138+
139+ isCancelDisabled: function() {
140+ return angular.equals(this.master, this.form);
141+ },
142+
143+ isSaveDisabled: function() {
144+ return this.userForm.$invalid || angular.equals(this.master, this.form);
137145 }
146+
138147 };
139148 </script>
140149 <div ng:controller="UserFormCntl">
@@ -172,10 +181,9 @@ The following example demonstrates:
172181 </ng:form>
173182
174183 <button ng:click="cancel()"
175- ng:disabled="{{master.$equals(form )}}">Cancel</button>
184+ ng:disabled="{{isCancelDisabled( )}}">Cancel</button>
176185 <button ng:click="save()"
177- ng:disabled="{{userForm.$invalid || master.$equals(form)}}">
178- Save</button>
186+ ng:disabled="{{isSaveDisabled()}}">Save</button>
179187 </form>
180188
181189 <hr/>
@@ -278,9 +286,9 @@ This example shows how to implement a custom HTML editor widget in Angular.
278286 this.htmlContent = '<b>Hello</b> <i>World</i>!';
279287 }
280288
281- function HTMLEditorWidget(element) {
289+ HTMLEditorWidget.$inject = ['$element', 'html$Filter'];
290+ function HTMLEditorWidget(element, htmlFilter) {
282291 var self = this;
283- var htmlFilter = angular.filter('html');
284292
285293 this.$parseModel = function() {
286294 // need to protect for script injection
@@ -309,7 +317,7 @@ This example shows how to implement a custom HTML editor widget in Angular.
309317 }
310318
311319 angular.directive('ng:html-editor-model', function() {
312- function linkFn ($formFactory, element) {
320+ return ['$formFactory', '$element', function ($formFactory, element) {
313321 var exp = element.attr('ng:html-editor-model'),
314322 form = $formFactory.forElement(element),
315323 widget;
@@ -318,15 +326,13 @@ This example shows how to implement a custom HTML editor widget in Angular.
318326 scope: this,
319327 model: exp,
320328 controller: HTMLEditorWidget,
321- controllerArgs: [ element] });
329+ controllerArgs: {$ element: element} });
322330 // if the element is destroyed, then we need to
323331 // notify the form.
324332 element.bind('$destroy', function() {
325333 widget.$destroy();
326334 });
327- }
328- linkFn.$inject = ['$formFactory'];
329- return linkFn;
335+ }];
330336 });
331337 </script>
332338 <form name='editorForm' ng:controller="EditorCntl">
0 commit comments