AngularJS - Sample Interview Question (Senior Level)

While running the below AngularJS code, you have encountered the following error in the console:

Error: Invalid value for <circle> attribute r="{{r}}"

What can be done to solve this error?

//AngularJS Code
<!doctype html>
<html ng-app>
  <head>
    <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.3/angular.min.js"></script>
  </head>
  <body>
    <div>
      <label>Name:</label>
      <input type="text" ng-model="r" placeholder="Enter Radius Size">      
      <hr>      
<svg width="200" height="200">
  <circle cx="150" cy="150" r="{{r}}"  stroke-width="4" fill="blue" />   
</svg> 
    </div>
  </body>
</html>

  1. Nothing, AngularJS does not support SVG
  2. Use the following attribute ng-attr-r (instead of r)
  3. Use the following attribute radius (instead of r)
Tests in AngularJS for Seniors

Test Name Difficulty Time (minutes) No. of Questions
AngularJS Online Test for Seniors AngularJS Senior 60 30

More Specific Tests in AngularJS for Seniors

Test Name Difficulty Time (Minutes) No. of Questions
AngularJS-Components Online Test for Seniors AngularJS - Components Senior 20 10
AngularJS-Controllers Online Test for Seniors AngularJS - Controllers Senior 20 10