就我而言,谷歌自动完成地址搜索工作正常。但是当我单击或按 Enter 键时,表单也会提交。我尝试了该活动preventdefault,但它不起作用!
这是我的指令代码。
myApp.directive('googleplace', function() {
return {
require: 'ngModel',
link: function(scope, element, attrs, model,event) {
var options = {
types: [],
};
scope.gPlace = new google.maps.places.Autocomplete(element[0], options);
google.maps.event.addListener(scope.gPlace, 'place_changed', function() {
var location = scope.gPlace.getPlace().geometry.location;
//
scope.$apply(function() {
scope.lat = location.lat();
scope.lng = location.lng();
event.preventDefault();
//alert(scope.lat);
});
});
}
};
});
Run Code Online (Sandbox Code Playgroud) 我正在创建新的用户角色“test_client”并且它正在工作但我的问题是我只想在仪表板中显示我的自定义插件页面菜单但在此代码中“manage_options”为“true”然后所有插件菜单都显示并且如果“manage_options”是'false' 不显示任何插件菜单..
$result = add_role('test_client', 'Test_client',
array(
// Dashboard
'read' => true, // true allows this capability
'edit_posts' => true, // Allows user to edit their own posts
'edit_pages' => true, // Allows user to edit pages
'edit_others_posts' => false, // Allows user to edit others posts not just their own
'create_posts' => false, // Allows user to create new posts
'manage_categories' => false, // Allows user to manage post categories
'publish_posts' => false, // Allows the user to publish, …Run Code Online (Sandbox Code Playgroud)