<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>AngularJS Training</title>
</head>
<body ng-app="app">
    Expression: {{ var1 }}
    <script src="https://code.angularjs.org/1.2.28/angular.js"></script>
    <script>
        angular
                .module('app', [])
                .run(function ($rootScope){
                    $rootScope.var1 = 'test';
                });

    </script>
</body>
</html>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>AngularJS Training</title>
</head>
<body ng-app="app">
    Expression: {{ var1 }}
    <script src="https://code.angularjs.org/1.2.28/angular.js"></script>
    <script>
        angular
                .module('app', [])
                .controller('MyController', function ($scope) {
                    $scope.var1 = 'test';
                });

    </script>
</body>
</html>
Switch using run to controller to set the variables but without binding it to the view.
Switch using run to controller to set the variables but without binding it to the view.
