我在我的角应用程序中有一个部分,我已经绑定了一个控制器,
从那时起我得到了参数'fn'不是函数错误,任何人都可以看看我的代码并解释为什么我得到了这个错误?
我会非常感激:)
HTML的标记:
<section class="col-lg-12" data-ng-controller="MessageController">
<fieldset>
<legend>{{ 'MESSAGES' | translate }}</legend>
</fieldset>
<div class="margin-left-15">
<ul class="list-style-button">
<li data-ng-repeat="message in MSG">{{ message }}</li>
</ul>
</div>
</section>
Run Code Online (Sandbox Code Playgroud)
控制器:
(function() {
'use strict';
var controllers = angular.module('portal.controllers');
controllers.controller('MessageController', ['$scope', 'MessageService', '$rootScope', function MessageController($scope, MessageService, $rootScope) {
$rootScope.MSG = MessageService.getMessages();
$rootScope.$watch('MSG', function(newValue) {
$scope.MSG = newValue;
});
}]);
}());
Run Code Online (Sandbox Code Playgroud)
服务:
(function() {
'use strict';
var messageServices = angular.module('portal.services');
messageServices.factory('MessageService', ['MessageData', 'localStorageService', 'UserService'], function(MessageData, localStorageService, UserService) {
return new MessageService(MessageData, localStorageService, UserService);
}); …
Run Code Online (Sandbox Code Playgroud) 基本上我有几个输入字段,其前缀有一些文本.当我尝试在输入组插件和输入字段本身上设置col-lg-4和col-lg-8时,它不会按照我的预期执行操作并调整它们的大小.
<div class="input-group">
<span class="input-group-addon">some text</span>
<input type="text" class="form-control" id="current_pwd" name="current_pwd" />
</div>
Run Code Online (Sandbox Code Playgroud)
谁能帮助我让输入组插件获得相同的大小?
我在这里创造了一个小提琴:http://jsfiddle.net/Dzhz4/解释了我的问题.
有人可以解决一些问题吗?
我有一个从服务器返回的模型,它包含html而不是文本(例如ab标签或i标签)
当我使用ng-repeat构建一个列表时,它将html显示为纯文本,是否有内置过滤器或指令,将html放在li项目内?
我查看了文档,但由于我还是很新,所以我很难找到它.
NG-重复:
<li ng-repeat="opt in opts">
Run Code Online (Sandbox Code Playgroud)
的jsfiddle:
你怎么用ng-repeat做角度这样的事情?我将使用文档中的示例,其中包含2个朋友的数组,如果我只想为所有26岁及以上的朋友重复一次,该怎么办?
<!doctype html>
<html ng-app>
<head>
<script src="http://code.angularjs.org/1.0.6/angular.min.js"></script>
</head>
<body>
<div ng-init="friends = [{name:'John', age:25}, {name:'Mary', age:28}]">
I have {{friends.length}} friends. They are:
<ul>
<li ng-repeat="friend in friends">
[{{$index + 1}}] {{friend.name}} who is {{friend.age}} years old.
</li>
</ul>
</div>
</body>
</html>
Run Code Online (Sandbox Code Playgroud) 我datepicker
在输入字段上有一个,我第一次打开时的默认日期是今天的日期,这就是我想要的.
但是,当我选择一个日期并清除输入字段时,datepicker
仍然有选定的日期,我不想要
有人知道为什么会发生这种情况以及如何防止这种行为?
我有一个select项目,我已经在
http://silviomoreto.github.io/bootstrap-select/ 上应用了selectpicker函数,
现在我正在尝试将input-group-addon与select对齐,后者变成了btn-group,但是插件的高度永远不会与btn-group的高度相同,我正在使用twitter bootstrap 3.
任何可以告诉我如何执行此操作的人,我的代码是:
<div class="input-group">
<span id="contact_servicecode" class="input-group-addon ng-binding">CONTACT_SERVICECODE</span>
<div class="btn-group bootstrap-select">
<button class="btn dropdown-toggle btn-custom" data-toggle="dropdown" type="button">
<div class="filter-option pull-left">1</div>
<div class="caret"></div>
</button>
<div class="dropdown-menu open">
<ul class="dropdown-menu inner" role="menu">
</div>
<select class="selectpicker mobile-device" style="display: none;">
<option value="1">1</option>
<option value="2">2</option>
</select>
</div>
</div>
Run Code Online (Sandbox Code Playgroud) 我目前正在开发一个需要具有翻译功能的angularJS应用程序,所以我检查了Angular-translate库并完成了示例中的所有操作.
但是,当我运行我的代码时,我收到以下错误:
错误:未知提供者:translateFilterProvider < - translateFilter
我在下面的jsfiddle中包含了我的代码:http ://jsfiddle.net/qYqw8/1/
我在调用小提琴中的代码之前加载了angular-translate javascript文件(在portal.js中)这是命令我加载我的文件:
<script src="js/lib/angular.js"></script>
<script src="js/lib/angular-resource.js"></script>
<script src="js/lib/jquery-1.10.js"></script>
<script src="js/lib/angular-translate.js"></script>
<script src="js/portal.js"></script>
Run Code Online (Sandbox Code Playgroud)
如果有人可以帮助我,我非常感激,
如果你想知道,因为我的小提琴有点混乱,我做了我的应用程序的bootstrap
<html lang="nl" ng-app="portal">
Run Code Online (Sandbox Code Playgroud)
谢谢,
J.
我们正在一步一步地脱离 spring-cloud Netflix OSS 生态系统。目前我们正在实现 spring-cloud-loadbalancer 并删除 Ribbon。然而,我们过去在集成测试中有很多静态服务,现在随着从功能区转向 spring-cloud-loadbalancer,这些属性不再被选取。IE:
foo-service.ribbon.NIWSServerListClassName=com.netflix.loadbalancer.ConfigurationBasedServerList
foo-service.ribbon.listOfServers=localhost:9876
Run Code Online (Sandbox Code Playgroud)
我们已通过以下方式迁移到使用 spring-cloud-loadbalancer
首先,我们使用 @LoadBalanced 注释我们的 Webclient.Builder,如下所示
@Bean
@LoadBalanced
fun webClientBuilder() = WebClient.builder()
Run Code Online (Sandbox Code Playgroud)
然后我们在客户端类上添加 @LoadBalancerClient 注释,如下所示
@LoadBalancerClient(name = "foo-service", configuration = [FooServiceConfiguration::class])
class FooServiceClient(private val basicAuthWebClient: WebClient)
Run Code Online (Sandbox Code Playgroud)
这会导致我们的测试失败,并出现 foo-service 的 UnknownHostException。
现在我的问题是我们如何在新的 spring-cloud-loadbalancer 中配置这个静态服务器列表?
我有一个工作的角度应用程序,我需要为其编写单元测试(我知道通常情况是相反的)。
每当我运行我的茉莉花任务时,我都会收到以下错误:
ReferenceError: Can't find variable: ApplicationService
Run Code Online (Sandbox Code Playgroud)
我们只是想在没有业力的情况下在 phantomJS 中运行测试,这可能吗?如果可以的话,你能看一下我的代码并告诉我出了什么问题吗?
我在 gruntfile 中添加了一个 jasmine 任务,如下所示:
jasmine:{
src: ['src/main/js/**/*.js'],
options:{
specs: 'src/test/js/**/*.js',
vendor: [ 'src/test/lib/**/*.js', 'src/main/lib/js/*.js']
}
},
Run Code Online (Sandbox Code Playgroud)
我尝试测试的服务位于文件“src/main/js/services/ApplicationService.js”中,如下所示:
(function(){
'use strict';
var services = angular.module('portal.services');
services.factory('ApplicationService', ['ApplicationData', 'localStorageService' ,'UserService', function(ApplicationData, localStorageService, UserService){
return new ApplicationService(ApplicationData, localStorageService, UserService);
}]);
function ApplicationService(ApplicationData, localStorageService, UserService){
this.applicationData = ApplicationData;
this.localStorageService = localStorageService;
this.userService = UserService;
}
ApplicationService.prototype.getApplications = function(entity){
var locale = this.userService.getUserinfoLocale();
var applications = this.localStorageService.get(Constants.key_applications+locale+'_'+entity);
if(applications !== null && applications !== undefined){ …
Run Code Online (Sandbox Code Playgroud) 我有一个具有一些共享字段的父类和一个扩展它的子类。
@SuperBuilder(toBuilder = true)
@Data
public abstract class MultiTenantAuthoredDocument {
@Indexed
private String tenantId;
@CreatedDate
private LocalDateTime createdDate;
@LastModifiedDate
private LocalDateTime lastModifiedDate;
}
@Document(collection = "users")
@SuperBuilder(toBuilder = true)
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class User extends MultiTenantAuthoredDocument {
@Id
private String id;
private String firstName;
private String lastName;
@Indexed
private String password;
@Indexed(unique = true)
private String userName;
@Indexed(unique = true)
private String email;
@Indexed
private List<UserRole> roles;
@Builder.Default
private boolean enabled = false;
}
Run Code Online (Sandbox Code Playgroud)
但是,在运行我的单元测试时,我在执行 …
为什么以下代码不会转到新页面?
$(document).ready(function(){
$(document.body).click(function(){
window.location.href="who.html" ;
});
});
Run Code Online (Sandbox Code Playgroud)
我没有看到任何直接的错误,我尝试过$(body)$('body')和$('#body'),每当我点击我的页面正文时我就不会去下一个页.
我有一个twitter bootstrap模式,我用数据标签创建,所以没有实际的JavaScript.
当我在模态对话框外面(在灰色区域上)单击时,它会关闭,但我想确保清除其中的字段.我尝试使用jQuery,如下所示:
$('#modal-form > .modal-dialog').on('blur', function(){
Utils.clearFields();
});
Run Code Online (Sandbox Code Playgroud)
但是我从来没有进入匿名函数,我是否绑定了错误的事件?或者我使用了错误的选择器(我也尝试过"$('#modal-form')")?
对此的任何帮助都非常感谢.
谢谢
javascript ×8
angularjs ×5
html ×3
jquery ×3
css ×2
datepicker ×1
jasmine ×1
lombok ×1
spring ×1
spring-boot ×1
spring-cloud ×1
unit-testing ×1