How to prevent runtime errors when working with angularjs and asp.net mvc

I am working on a system that uses ASP.NET MVC and angularjs.

Sometimes, by mistake, the reference functions of the .cshtml files are stored in angular controllers that do not exist, usually due to a spelling error.

Here is an example. The second button uses the SetTxt function, which must be a SetText.

<button ng-click="SetText('account')">Click Here</button>

<button ng-click="SetTxt('account')">Click Here</button>

app.controller('MyController', '$scope', function ($scope) {
   $scope.SetText = function (text) {
      $scope.currentText = text;
   };
}

Is there an automated and easy way / tool to identify this kind of error on all html pages before deployment and manual QA?

Thanks!

+4
source share

Source: https://habr.com/ru/post/1618668/


All Articles