Skip to content

Instantly share code, notes, and snippets.

@sayedmohamed
Created June 4, 2014 09:22
Show Gist options
  • Select an option

  • Save sayedmohamed/2b43778bafff63b11e70 to your computer and use it in GitHub Desktop.

Select an option

Save sayedmohamed/2b43778bafff63b11e70 to your computer and use it in GitHub Desktop.

Revisions

  1. sayedmohamed created this gist Jun 4, 2014.
    17 changes: 17 additions & 0 deletions jsbin.mofih.html
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,17 @@
    <!DOCTYPE html>
    <html ng-app='myapp'>
    <head>
    <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.14/angular.min.js"></script>
    <meta charset="utf-8">
    <title>JS Bin</title>
    </head>
    <body>
    <div class="container" ng-controller='SimpleController'>
    search:<input type='text' ng-model='name'>
    <br />
    <ul>
    <li ng-repeat='cust in customers|filter:name'>{{cust.name}} - {{cust.city}}</li>
    </ul>
    </div>
    </body>
    </html>
    23 changes: 23 additions & 0 deletions jsbin.mofih.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,23 @@
    var myapp=angular.module('myapp',[]);
    myapp.config(function($routeProvider){
    $routeProvider
    .when('/',
    {
    controller:'SimpleController',
    templateUrl:'partials/view1.html'
    })
    .when('/partial2',
    {
    controller:'SimpleController',
    templateUrl:'partials/view2.html'
    })
    .otherwise({redirectTo:'/'});
    });

    myapp.controller('SimpleController',function($scope){
    $scope.customers=[
    {name:'sayed',city:'cairo'},
    {name:'ahamed',city:'alex'},
    {name:'mohamed',city:'los anglous'}
    ];
    });