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

Create boilerplate for Angular 1.x #6

Open
stefek99 opened this Issue Sep 23, 2015 · 2 comments

Comments

Projects
None yet
1 participant
@stefek99
Owner

stefek99 commented Sep 23, 2015

<!doctype html>
<html>
  <head>
    <script src="http://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
    <script src='http://ajax.googleapis.com/ajax/libs/angularjs/1.2.28/angular.min.js'></script>
    <script>
      var app = angular.module("app", []);

      app.controller("ctrl", function($scope) {
        $scope.message = "It works!";
      });

    </script>
  </head>
  <body ng-app="app" ng-controller="ctrl">
    {{ message }}

  </body>
</html>
@stefek99

This comment has been minimized.

Show comment
Hide comment
@stefek99

stefek99 Apr 14, 2017

Owner
<!doctype html>

<html>
  <head>
    <script src="http://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
    <script src='http://ajax.googleapis.com/ajax/libs/angularjs/1.5.3/angular.min.js'></script>
    <script src='http://ajax.googleapis.com/ajax/libs/angularjs/1.5.3/angular-route.js'></script>
    <script>
      var app = angular.module("app", ["ngRoute"]);

      app.config(function ($routeProvider) {
        $routeProvider
          .when('/home', {
            templateUrl: 'home.html'
          })
          .when('/login', {
            templateUrl: 'login.html',
            controller: "LoginCtrl"
          })
          .otherwise('/home')
      });

      app.controller("LoginCtrl", function($scope) {
        $scope.message = "It works!";
      });

    </script>
  </head>
  <body ng-app="app">

    <div ng-view></div>

    <script type="text/ng-template" id="home.html">
      <h1>Home</h1>
    </script>

    <script type="text/ng-template" id="login.html">
      <h1>Login</h1>
      {{ message }}
    </script>

  </body>
</html>
Owner

stefek99 commented Apr 14, 2017

<!doctype html>

<html>
  <head>
    <script src="http://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
    <script src='http://ajax.googleapis.com/ajax/libs/angularjs/1.5.3/angular.min.js'></script>
    <script src='http://ajax.googleapis.com/ajax/libs/angularjs/1.5.3/angular-route.js'></script>
    <script>
      var app = angular.module("app", ["ngRoute"]);

      app.config(function ($routeProvider) {
        $routeProvider
          .when('/home', {
            templateUrl: 'home.html'
          })
          .when('/login', {
            templateUrl: 'login.html',
            controller: "LoginCtrl"
          })
          .otherwise('/home')
      });

      app.controller("LoginCtrl", function($scope) {
        $scope.message = "It works!";
      });

    </script>
  </head>
  <body ng-app="app">

    <div ng-view></div>

    <script type="text/ng-template" id="home.html">
      <h1>Home</h1>
    </script>

    <script type="text/ng-template" id="login.html">
      <h1>Login</h1>
      {{ message }}
    </script>

  </body>
</html>
@stefek99

This comment has been minimized.

Show comment
Hide comment
@stefek99

stefek99 Apr 14, 2017

Owner

With Bootstrap

<!doctype html>

<html>
  <head>
    <script src="http://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
    <script src='http://ajax.googleapis.com/ajax/libs/angularjs/1.3.14/angular.min.js'></script>
    <script src='https://cdnjs.cloudflare.com/ajax/libs/angular-ui-bootstrap/0.12.1/ui-bootstrap-tpls.min.js'></script>
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap.min.css">

    <meta name="viewport" content="width=device-width, initial-scale=1">

    <script>
      var app = angular.module("app", ['ui.bootstrap']);

      app.controller('ctrl', function ($scope) {
        
        $scope.alerts = [
          { type: 'danger', msg: 'Oh snap! Change a few things up and try submitting again.' },
          { type: 'success', msg: 'Well done! You successfully read this important alert message.' }
        ];

        $scope.addAlert = function() {
          $scope.alerts.push({msg: 'Another alert!'});
        };

        $scope.closeAlert = function(index) {
          $scope.alerts.splice(index, 1);
        };

      });
    </script>
  </head>
  <body ng-app="app">

    <div ng-controller="ctrl">

  <alert ng-repeat="alert in alerts" type="{{alert.type}}" close="closeAlert($index)">{{alert.msg}}</alert>
  <button class='btn btn-default' ng-click="addAlert()">Add Alert</button>


    </div>

  </body>
</html>
Owner

stefek99 commented Apr 14, 2017

With Bootstrap

<!doctype html>

<html>
  <head>
    <script src="http://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
    <script src='http://ajax.googleapis.com/ajax/libs/angularjs/1.3.14/angular.min.js'></script>
    <script src='https://cdnjs.cloudflare.com/ajax/libs/angular-ui-bootstrap/0.12.1/ui-bootstrap-tpls.min.js'></script>
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap.min.css">

    <meta name="viewport" content="width=device-width, initial-scale=1">

    <script>
      var app = angular.module("app", ['ui.bootstrap']);

      app.controller('ctrl', function ($scope) {
        
        $scope.alerts = [
          { type: 'danger', msg: 'Oh snap! Change a few things up and try submitting again.' },
          { type: 'success', msg: 'Well done! You successfully read this important alert message.' }
        ];

        $scope.addAlert = function() {
          $scope.alerts.push({msg: 'Another alert!'});
        };

        $scope.closeAlert = function(index) {
          $scope.alerts.splice(index, 1);
        };

      });
    </script>
  </head>
  <body ng-app="app">

    <div ng-controller="ctrl">

  <alert ng-repeat="alert in alerts" type="{{alert.type}}" close="closeAlert($index)">{{alert.msg}}</alert>
  <button class='btn btn-default' ng-click="addAlert()">Add Alert</button>


    </div>

  </body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment