0
    <html ng-app>
    <head>
    </head>
    <body data-ng-controller="Myfunc">
    <ol type="i">
    <li data-ng-repeat="c in cust | filter:name"> {{ c.name | lowercase}} - {{c.city | lowercase}}</li>
    </ol>
   <script src="angular.js"></script>
   <script>

    function Myfunc($scope)
    {
    $scope.cust=[
    {name:'grimer',city:'ambernath'},
    {name:'primer',city:'goregaon'}
    ];
    }
    </script>
    </body>
    </html>

custom controller not working in angularjs don't know whether the custom script is working or not or something else

1 Answer 1

1

I have updated your code and it is now working:

<html>

<head></head>

<body>

<div ng-app>
  <div data-ng-controller="Myfunc">
    <ol type="i">
      <li data-ng-repeat="c in cust | filter:name"> {{ c.name | lowercase}} - {{c.city | lowercase}}</li>
    </ol>

    <script src="angular.js"></script>
    <script>
      function Myfunc($scope) {
        $scope.cust = [{
          name: 'grimer',
          city: 'ambernath'
        }, {
          name: 'primer',
          city: 'goregaon'
        }];
      }
    </script>

  </div>
</div>
</body>

</html>

What I did is to move ng-app to a div and the data-ng-controller="Myfunc" to a div inside it.

You can find the working version at this js_fiddle url.

Sign up to request clarification or add additional context in comments.

6 Comments

Did you try out the jsfiddle link: jsfiddle.net/U3pVM/24899 ? Also I have used angular version 1.0.3
thank you sir i now tried with older version of .js and now its working but what might be the reason that it is not working with the new one ?
Where did you get the angular.js source?
No no no , I mean I wanted to check the exact file that you have, if you can provide me a link.
sir i have downloaded .js from this link itself first i was using the 1.5 version now i'm using 1.2 version
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.