提交 94ec5690 编写于 作者: B bryk

Merge remote-tracking branch 'origin/master' into travis-configuration

......@@ -10,21 +10,12 @@
"angular-aria": "~1.4.2",
"angular-material": "~0.10.1",
"angular-messages": "~1.4.2",
"angular-new-router": "~0.5.3",
"angular-resource": "~1.4.2",
"angular-route": "~1.4.2",
"angular-sanitize": "~1.4.2"
},
"devDependencies": {
"angular-mocks": "~1.4.2",
"google-closure-library": "*"
},
"//": "Some dependencies do not have main files defined. Override this here so that",
"//": "build tools know what files to serve.",
"overrides": {
"angular-new-router": {
"main": [
"dist/router.es5.js"
]
}
}
}
......@@ -26,7 +26,7 @@
experience.</p>
<![endif]-->
<div ng-viewport ng-controller="RouterController"></div>
<div ng-view> <!-- Application content is inserted here. --> </div>
<!-- build:js console/vendor.js -->
<!-- bower:js -->
......
......@@ -16,16 +16,19 @@
* @fileoverview Entry point module to the application. Loads and configures other modules needed
* to bootstrap the application.
*/
import {config} from './index.config';
import {RouterController, routerConfig} from './index.route';
import {runBlock} from './index.run';
import {MainController} from './main/main.controller';
import routeConfig from './index.route';
import mainModule from './main/main.module';
export default angular.module(
'kubernetesConsole',
['ngAnimate', 'ngSanitize', 'ngMessages', 'ngAria', 'ngResource', 'ngNewRouter', 'ngMaterial'])
.config(config)
.config(routerConfig)
.run(runBlock)
.controller('RouterController', RouterController)
.controller('MainController', MainController);
[
'ngAnimate',
'ngAria',
'ngMaterial',
'ngMessages',
'ngResource',
'ngRoute',
'ngSanitize',
mainModule.name,
])
.config(routeConfig);
......@@ -14,24 +14,9 @@
/**
* @param {!ngNewRouter.$componentLoaderProvider} $componentLoaderProvider
* @param {!angular.$routeProvider} $routeProvider
* @ngInject
*/
export function routerConfig($componentLoaderProvider) {
$componentLoaderProvider.setTemplateMapping(function(name) {
return `${name}/${name}.html`;
});
}
export class RouterController {
/**
* @param {!ngNewRouter.$router} $router
* @ngInject
*/
constructor($router) {
$router.config([
{path: '/', component: 'main'},
]);
}
export default function routeConfig($routeProvider) {
// TODO(bryk): Configure 'otherwise' route here.
}
......@@ -13,18 +13,15 @@
// limitations under the License.
export class MainController {
constructor() {
/** @export */
this.testValue = 7;
}
export default class MainController {
/**
* @param {!angular.$timeout} $timeout
* @ngInject
* @export
*/
activate($timeout) {
constructor($timeout) {
/** @export */
this.testValue = 7;
$timeout(() => {
this.testValue = 8;
}, 4000);
......
<div layout="vertical" layout-fill>
<md-content>
<header>
Hello world! {{main.testValue}}
Hello world! {{ctrl.testValue}}
</header>
<section class="jumbotron">
......
// Copyright 2015 Google Inc.
// Copyright 2015 Google Inc. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
......@@ -12,11 +12,8 @@
// See the License for the specific language governing permissions and
// limitations under the License.
import routeConfig from './main.route';
/**
* @param {!angular.$log} $log
* @ngInject
*/
export function runBlock ($log) {
$log.debug('runBlock end');
}
export default angular.module('kubernetesConsole.main', [])
.config(routeConfig);
// Copyright 2015 Google Inc.
// Copyright 2015 Google Inc. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
......@@ -12,28 +12,17 @@
// See the License for the specific language governing permissions and
// limitations under the License.
/**
* @fileoverview Externs for Angular router: https://github.com/angular/router
*
* TODO(bryk): Move the externs out of this project.
*/
/** @const */
var ngNewRouter = {};
/**
* @typedef {{
* setTemplateMapping: function(function(string):string)
* }}
*/
ngNewRouter.$componentLoaderProvider = {};
import MainController from './main.controller';
/**
* @typedef {{
* config: function(!Array<{path: string, component: string}>)
* }}
* @param {!angular.$routeProvider} $routeProvider
* @ngInject
*/
ngNewRouter.$router = {};
export default function routeConfig($routeProvider) {
$routeProvider.when('/', {
templateUrl: 'main/main.html',
controller: MainController,
controllerAs: 'ctrl',
});
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册