Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angularjs/24.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 如何使用angular.module和angular Material添加多个依赖项_Javascript_Angularjs_Dependency Injection_Module_Angular Material - Fatal编程技术网

Javascript 如何使用angular.module和angular Material添加多个依赖项

Javascript 如何使用angular.module和angular Material添加多个依赖项,javascript,angularjs,dependency-injection,module,angular-material,Javascript,Angularjs,Dependency Injection,Module,Angular Material,我的表格/输入和按钮没有显示,我的角度材料有问题。 我猜这是因为我没有添加ngMaterial作为依赖项。当我这样做时,它会破坏我的代码 这是我的原始app.js文件: angular.module('myApp',['ngRoute',])) .config([ “$compileProvider”, 函数($compileProvider){ var currentIMGSRCSanitationWhiteList=$compileProvider.IMGSRCSanitationWhit

我的表格/输入和按钮没有显示,我的角度材料有问题。 我猜这是因为我没有添加ngMaterial作为依赖项。当我这样做时,它会破坏我的代码

这是我的原始app.js文件:

angular.module('myApp',['ngRoute',]))
.config([
“$compileProvider”,
函数($compileProvider){
var currentIMGSRCSanitationWhiteList=$compileProvider.IMGSRCSanitationWhiteList();
var newImgSrcSanitizationWhiteList=currentImgSrcSanitizationWhitelist.toString().slice(0,-1)
+“| chrome扩展名:”
+currentImgSrcSanitizationWhitelist.toString().slice(-1);
log(“将IMGSRCSanitationWhiteList从“+CurrentIMGSRCSanitationWhiteList+”更改为“+NewIMGSRCSanitationWhiteList”);
$compileProvider.imgsrcsanitationwhitelist(newimgsrcsanitationwhitelist);
}
])
.config(函数($routeProvider){
$routeProvider
。当(“/”{
templateUrl:'templates/home.html',
控制器:“MainCtrl”
})
.when(“/settings”{
templateUrl:'templates/settings.html',
控制器:“设置SCTRL”
})
。否则({重定向到:'/'});
})
.provider(“天气”,函数(){
var apiKey=“”;
this.setApiKey=函数(键){
如果(关键){
this.apiKey=key;
}
};
this.getUrl=函数(类型,ext){
返回“http://api.wunderground.com/api/“+this.apiKey+”/“+类型+
“/q/”+ext+“.json”;
};
这个。$get=function($q,$http){
var self=这个;
返回{
getWeatherForecast:功能(城市){
var d=$q.defer();
$http({
方法:“获取”,
url:self.getUrl(“预测”,城市),
缓存:真
}).成功(功能(数据){
//预测嵌套在forecast.simpleforecast中
//控制台日志(数据);
d、 解析(data.forecast.simpleforecast);
}).错误(函数(错误){
d、 拒绝(错误);
});
回报承诺;
}
};
};
})
.config(函数(WeatherProvider){
WeatherProvider.setApiKey('7b78fc434225f02f');
})
.controller('MainCtrl',
函数($scope、$timeout、Weather){
//生成日期对象
$scope.date={};
//更新功能
var updateTime=function(){
$scope.date.raw=新日期();
$timeout(updateTime,1000);
}
//启动更新功能
updateTime();
$scope.weather={};
天气。获取天气预报(“IL/芝加哥”)
.then(功能(数据){
$scope.weather.forecast=数据;
});
});

威瑟姆
{{date.raw}日期:'EEEE MMMM yyyy'}
{{date.raw | date:'hh:mm'}{{{date.raw | date:'ss'}}
现在
{{day.date.weekday}
低:{day.Low.fahrenheit}
高:{day.High.fahrenheit}
{{day.conditions}}
主要的,重要的

首先要链接angular.min.js两次,一次在开头,一次在结尾。另外,在“角度动画”之后,将指向角度材质的链接放在最后一个位置