angular ngmodel - AngularJs - force scope property to exist on angularJs binding -


I have noticed that when a property is bound, which is not present in the current radius, then you get JavaScript error But believe that Angelor has established a new property on the scope.

I used Knock OutJs, which put a JS error when the data-barred expression mentioned an undefined property on the View Module.

Is there a way to configure Angulios to do the same thing? I like this 'strict' verification approach, because JS error message helps troubleshoot

example HTML:

  & lt; Div ng-app & gt; & Lt; Div ng-controller = "ctrl" & gt; {{Username1}} & lt; / Div & gt; & Lt; / Div & gt;  

and Javascript:

  function ctrl ($ scope) {$ scope.username = 'user1'; }  

Typo on HTML means that the binding does not match. It would be great to get a JS error to tell me ...

Which defines essential for the property:

  app.filter ("throwUndefined", function ($ exception handler) {return function (input) {if (input === undefined) {$ ExceptionHandler (new error ("property was undefined"), "throw filter");} return input;};});  

Looks like a little overhead but with HTML it looks like:

  & lt; Div ng-app = "myApp" ng-controller = "myController" & gt; {{Variables | ThrowUndefined}} {{variable1 | ThrowUndefined}} & lt; / Div & gt;  

The undefined variable will call the exception handler, there is no way to look at this property or to see whether this property was not, or was not determined according to the value, But you can select the call stack to find it. It seems that you want more trust between your view and controller, though - that is what I say is your controller check, but if you do this then you can always make sure the price is set.

Bella:


Comments