如何为ng-include sidepanel.html编写控制器?

时间:2015-11-11 17:58:58

标签: javascript angularjs angular-ui-router

我是angularjs的新手,我们正在使用angularJs AMD。

的index.html

<div ng-controller=“MainController">
    <div ng-include src="'sidepanel.html'"></div>
</div>

app.js

   'use strict';

define(['angularAMD', 'ui-router', 'ui_bootstrap', 'jquery-ui', 'angularModalService', 'bootstrapjs'], function (angularAMD) {
    var app = angular.module("sampleApp", ['ui.router', 'ui.bootstrap', 'angularModalService']);

//Main Controller
    app.controller('MainController', ['$scope', '$rootScope', '$timeout', '$state', '$window',
        function ($scope, $rootScope, $timeout, $state, $window) {
            $rootScope.sampleTest = 'Welcome Test';
        }]);
    app.config(['$stateProvider', '$locationProvider', '$urlRouterProvider', function ($stateProvider, $locationProvider, $urlRouterProvider) {
            $urlRouterProvider.otherwise('/home');
            $stateProvider.state('Home', {
                url: '/home',
                views: {
                    'content': {
                        templateUrl: 'views/home.html',
                        controller: 'HomeController'
                    }
                }
            });
        }]);

// Bootstrap Angular when DOM is ready
    angularAMD.bootstrap(app);

    return app;
});

我的问题在这里。

如何在此处编写侧面板控制器。

示例github:https://github.com/marcoslin/angularAMD/tree/master/www

0 个答案:

没有答案