我一直在玩bootstrap 3,我注意到如果你使用没有容器的网格系统就会变得流畅,有人告诉我我不应该这样做,因为系统设计在一个容器内.如果我不使用容器类会发生什么?,我是否需要它?如果可以的话,我可以使容器类宽度100%而不会弄乱引导程序的媒体查询,或者是否有任何其他或更好的方法来构建流体布局与引导3.
我开始使用angular,我怎么能将代码从一个应用程序分解成多个文件?我看了60分钟的介绍,他们提到我可以在没有requirejs或任何其他框架的情况下执行此操作.
让我们说我有这样的东西工作得很好:
var app = angular.module('app', []);
app.factory('ExampleFactory', function () {
var factory = {};
factory.something = function(){
/*some code*/
}
return factory;
});
app.controller ('ExampleCtrl', function($scope, ExampleFactory){
$scope.something = function(){
ExampleFactory.something();
};
});
app.config(function ($routeProvider) {
$routeProvider
.when('/',
{
controller: 'ExampleCtrl',
templateUrl: 'views/ExampleView.html'
})
.otherwise({ redirectTo: '/' });
});
Run Code Online (Sandbox Code Playgroud)
如果我想将它放在单独的文件中怎么办?像这样
文件一:
angular.module('factoryOne', [])
.factory('ExampleFactory', function () {
var factory = {};
factory.something = function(){
/*some code*/
}
return factory;
});
Run Code Online (Sandbox Code Playgroud)
文件二:
angular.module('controllerOne', ['factoryOne'])
.controller ('ExampleCtrl', function($scope,ExampleFactory){
$scope.something = function(){ …Run Code Online (Sandbox Code Playgroud)