コード例 #1
0
ファイル: Example.php プロジェクト: maveius/liphte
 public function index()
 {
     $t = new Tag();
     echo "\n";
     echo "\n";
     echo $t->doctype($t->html(['ng-app' => 'nameApp'], [$t->head([$t->meta(['charset' => 'utf-8']), $t->title('Angular.js Example'), $t->script(['src' => 'https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.4.1/angular.min.js']), $t->script([' var nameApp = angular.module(\'nameApp\', []);
                             nameApp.controller(\'NameCtrl\', function( $scope ) {
                                 $scope.names = [\'Lary\', \'Curly\', \'Moe\'];
                                 $scope.addName = function () {
                                     $scope.names.push($scope.enteredName);
                                 }
                                 //$scope.firstName = \'John\';
                                 //
                                 //$scope.$watch(\'lastName\', function(newValue, oldValue) {
                                 //    console.log(\'new value is \' + newValue);
                                 //});
                                 //
                                 //setTimeout(function(){
                                 //    $scope.lastName = \'Smith\';
                                 //    $scope.$apply();
                                 //}, 1000);
                             });'])]), $t->body(['ng-controller' => 'NameCtrl'], [$t->ul([$t->li(['ng-repeat' => 'name in names track by $index'], ['{{name}}'])]), $t->form(['ng-submit' => 'addName()'], [$t->input(['type' => 'text', 'ng-model' => 'enteredName']), $t->input(['type' => 'submit', 'value' => 'add'])])])]));
     echo "\n";
 }