初始
This commit is contained in:
45
source/javascript/app.js
Normal file
45
source/javascript/app.js
Normal file
@ -0,0 +1,45 @@
|
||||
// Declare the flexboxDemoApp module and its dependency 'ngMaterial'
|
||||
var app = angular.module('flexboxDemoApp', ['ngMaterial']);
|
||||
// Declare the AppCtrl controller
|
||||
app
|
||||
.config(['$mdThemingProvider', function ($mdThemingProvider) {
|
||||
$mdThemingProvider
|
||||
.theme('default')
|
||||
.accentPalette('amber', {
|
||||
default: '700'
|
||||
});
|
||||
}])
|
||||
.controller('AppCtrl', ['$scope', function ($scope) {
|
||||
$scope.parent = {
|
||||
flexDirection: 'row',
|
||||
flexWrap: 'nowrap',
|
||||
justifyContent: 'flex-start',
|
||||
alignItems: 'stretch',
|
||||
alignContent: 'stretch'
|
||||
};
|
||||
|
||||
$scope.children_width = 12; // %
|
||||
|
||||
$scope.children = [];
|
||||
|
||||
var addChild = function (order, flexGrow, flexShrink, flexBasis, alignSelf) {
|
||||
$scope.children.push({
|
||||
order: order || 0,
|
||||
flexGrow: flexGrow || 0,
|
||||
flexShrink: flexShrink || 1,
|
||||
flexBasis: flexBasis || 'auto',
|
||||
alignSelf: alignSelf || 'auto'
|
||||
});
|
||||
};
|
||||
var removeChild = function (index) {
|
||||
$scope.children.splice(index, 1);
|
||||
};
|
||||
|
||||
$scope.addChild = addChild;
|
||||
$scope.removeChild = removeChild;
|
||||
|
||||
for (var i = 0; i < 5; i++) {
|
||||
addChild();
|
||||
}
|
||||
|
||||
}]);
|
Reference in New Issue
Block a user