我在AngularJS路由方面遇到了很大的问题.
直到最近,一切都很好,有以下路线:
$routeProvider.when('/album/:albumId', {
controller: 'albumPageController',
templateUrl: 'views/album.html'
});
Run Code Online (Sandbox Code Playgroud)
并使用href:
<a href="/#/album/{{album.id}}">Link</a>
Run Code Online (Sandbox Code Playgroud)
但是,现在所有的斜杠都被编码成了%2F.
因此,当我单击链接或键入localhost:8000/#/album/1浏览器时,URL将更改为:
我已经尝试了几件事来纠正这个问题:
使用ng-href代替href,不使用第一个/(即href="#/album/{{album.id}}")在Homestead localhost(Laravel的linux vagrant机器)中运行应用程序而不是Windows 10上的localhost
任何帮助将非常感激!
我正在为网站注册页面。我了解要创建一个新用户,需要一个id,因此我们有以下字段:
<input type="hidden" th:field="{*id} />
Run Code Online (Sandbox Code Playgroud)
但是,当我转到页面时,我得到了本文标题中提到的错误。
这是有问题的表格:
<form th:action="@{/users/register}" th:object="${user}" class="form-signin" method="POST">
<h2 class="form-signin-heading">Register</h2>
<input type="hidden" th:field="*{id}" />
<label for="inputUsername" class="sr-only">Username*</label>
<input type="text" th:field="*{username}" name="username" id="inputUsername" class="form-control" placeholder="Username" required="required" autofocus="autofocus" />
<label for="inputEmail" class="sr-only">Email Address*</label>
<input type="text" th:field="*{email}" name="email" id="inputEmail" class="form-control" placeholder="Email address" required="required" autofocus="autofocus" />
<label for="inputPassword" class="sr-only">Password</label>
<input type="password" th:field="*{password}" name="password" id="inputPassword" class="form-control" placeholder="Password" required="required" />
<label for="inputConfirmPassword" class="sr-only">Confirm Password</label>
<input type="password" th:field="${confirmPassword}" name="confirmPassword" id="inputConfirmPassword" class="form-control" placeholder="Confirm password" required="required" />
<button class="btn btn-lg btn-primary btn-block" type="submit">Register</button>
</form>
Run Code Online (Sandbox Code Playgroud)
这是我的UserController: …
我正在使用Materialise CSS框架,表单验证不起作用.
电子邮件验证工作正常:
<div class="row">
<div class="input-field col s12 m5 offset-m3">
<i class="material-icons prefix">email</i>
<input type="email" id="input_email" name="email" class="validate" />
<label for="input_email" data-error="Please enter a valid email address">Email</label>
</div>
</div>
Run Code Online (Sandbox Code Playgroud)
但是,当涉及到一个简单的必填字段时,验证不起作用......
<div class="row">
<div class="input-field col s12 m5 offset-m3">
<i class="material-icons prefix">account_circle</i>
<input type="text" id="input_name" data-error="Please enter your name" name="input_name" class="validate" required="required" aria-required="true"/>
<label for="input_name">Name</label>
</div>
</div>
Run Code Online (Sandbox Code Playgroud)
正如另一篇文章所述,
我已经添加了必需的和aria-required属性(包含required ="required"和required =""值[我不知道为什么会提到这个,据我所知前者是正确的]).但是,除了电子邮件字段之外,验证仍然没有做任何事情......
我究竟做错了什么?
谢谢
PS
Materialise HTML和Javascript的CDN在这里:
<!--Import Google Icon Font-->
<link href="http://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
<!-- Compiled and minified CSS --> …Run Code Online (Sandbox Code Playgroud) forms ×2
angularjs ×1
href ×1
html ×1
laravel ×1
materialize ×1
spring ×1
spring-boot ×1
thymeleaf ×1
validation ×1