Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ngRoute not working. is there something i am doing wrong. #5

Open
shahakshit opened this issue Apr 14, 2014 · 0 comments
Open

ngRoute not working. is there something i am doing wrong. #5

shahakshit opened this issue Apr 14, 2014 · 0 comments

Comments

@shahakshit
Copy link

<title>a</title> <script src="Scripts/angular.min.js" type="text/javascript"></script> <script src="Scripts/angular-route.min.js" type="text/javascript"></script> <script type="text/javascript"> var App = angular.module('App', ['ngRoute']);
        App.config(function ($routeProvider) {                
            $routeProvider
                .when('/', { templateUrl: 'Partials/View1.htm', controller: 'SimpleController' })
                .when('/partial2', { templateUrl: 'Partials/View2.htm', controller: 'SimpleController' })
                .otherwise({ redirectTo: '/AJTest' });
        });

        App.controller('SimpleController', function ($scope) {
            $scope.customers =
                                [
                                    { name: 'a', city: 'a' },
                                    { name: 'b', city: 'b' },
                                    { name: 'c', city: 'c' },
                                    { name: 'd', city: 'd' }
                                ];
            $scope.addCustomer = function () {
                $scope.customers.push({ name: $scope.newCustomer.name, city: $scope.newCustomer.city });
            }
        });

    </script> 
    <div data-ng-controller="SimpleController">
        Name :<br /> 
        <input type="text" data-ng-model="name" />  {{ name }}    
        <ul>
            <li data-ng-repeat="cust in customers | filter:name | orderBy:city">{{ cust.name  + ' ' + cust.city}} </li>
        </ul>
    </div>                                
</body>
---------------------**********************************************---------------------------------------- Partials\View1.htm goes like this.

View 1

Name :

  • {{ cust.name }}

CustomerName : CustomerCity : Add Customer

Please help. thanks in advance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant