Hello
My problem is using angular directive ng-controller outside of ng-view
I just tried to add the ng-controller="SampleController" into <body> tag, 
but I got errors 

Argument 'SampleController' is not a function, got undefined


i have this structure

<!doctype html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title></title>
    {!! HTML::style('app/css/bootstrap.min.css') !!}
    {!! HTML::style('app/css/app.css') !!}
</head>
<body ng-controller="SampleController">
    <nav class="navbar navbar-default navbar-static-top">
        <div class="container">
            <div class="navbar-header">
            </div>

            <div id="navbar" class="navbar-collapse collapse">
                <ul class="nav navbar-nav navbar-right">
                </ul>
            </div>
        </div>
    </nav>

<div class="content" style="height:1600px">

<h1> <%greeting%> </h1>
    <div class="container">
            <div ng-view></div>
    </div>
</div>

<footer class="footer" style="text-align: center">
</footer>
{!! HTML::script('app/lib/require/require.min.js', array('data-main' => 
'app/js/main')) !!}
</body>
</html>

My app.js 

define(['angular',
        'utils/route-config',
        'angular-route'
], function (angular, routeConfig) {

  var app = angular.module('stase-main', ['ngRoute'], function 
($controllerProvider, $compileProvider, $provide, $filterProvider, 
$locationProvider) {
    $interpolateProvider.startSymbol('<%');
    $interpolateProvider.endSymbol('%>');
    routeConfig.setAllProviders({
      controllerProvider: $controllerProvider,
      compileProvider: $compileProvider,
      provide: $provide,
      filterProvider: $filterProvider
    });
  });
  app.register.controller('GreetingController', ['$scope', function($scope) {
    $scope.greeting = 'Hola!';
  }]);
  return app;
});

-- 
You received this message because you are subscribed to the Google Groups 
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to