angularjs - 天气应用程序的Angularjs单元测试用例
问题描述
如何为波纹管控制器编写单元测试用例。我对 angularjs 完全陌生,我必须解决这个问题。请指导我
angular.module('ourAppApp')
.controller('MainCtrl', function($scope,apiFac) {
$scope.displayCity = false;
$scope.displayWeather = false;
$scope.today = new Date();
$scope.searchCity = function(){
if($scope.cityInput != ""){
apiFac.searchCity($scope.cityInput).then(function(response){
$scope.searchResponse = response;
$scope.displayCity = true;
})
}
}
$scope.getcitydetails = function(item){
$scope.cityInput = "";
$scope.displayCity = false;
$scope.selectedCity = item;
apiFac.weatherReport(item.woeid).then(function(response){
$scope.weatherResponse = response;
$scope.displayCity = false;
$scope.displayWeather = true;
})
}
})
解决方案
推荐阅读
- javascript - 如何在nodejs中将对象转换为protobuf数据
- c++ - Vxworks7:Boost V1.75 标志:BOOST_THREAD_USES_GETPAGESIZE
- python - 解析具有不匹配列的 CSV 数据 - Python Pandas
- paypal - 如何在 NuxtJs 中集成 PayPal 智能支付按钮?
- azure - 如何通过带有 Az 模块的 PowerShell 获取 Azure 资源的 cpu 使用率
- api - 寻找 API 端点以获取市场上可用的 github 操作列表
- java - Android - 检测到 wifi 上的启动事件或“位置已更改”
- entity-framework - 在 EF6 DbContext 模型中将缺少的 DB 列声明为可为空时忽略它们
- http - HTTP POST 请求的词源?
- c++ - 动态分配内存和分配单个数组值