我试图在我的应用程序中使用Bootstrap 工具提示.目前,我有以下内容:
<button type="button" class="btn btn-default"
data-toggle="tooltip" data-placement="left"
title="Tooltip on left">
Tooltip on left
</button>
Run Code Online (Sandbox Code Playgroud)
不幸的是,我的工具提示没有显示.我想弄清楚我做错了什么.我知道它可以通过JavaScript创建.但是,我正在尝试以声明方式定义我的工具提示.我已经确认包含了Tooltip.js文件.但是,我无法弄清楚我做错了什么.
是否可以在纯粹的声明意义上使用工具提示?如果是这样,有人可以通过JSFiddle或Bootply样本向我展示如何?我真的在敲打这个.
我试图使用以下命令创建仪表板:
ng generate @angular/material:materialDashboard --name myDashboard
Run Code Online (Sandbox Code Playgroud)
当我执行命令时,它导致错误:
Schematic "materialDashboard" not found in collection
"@angular/material". Error: Schematic "materialDashboard" not found in
collection "@angular/material".
at SchematicEngine.createSchematic (/Users/xyx/Desktop/Git/question-authoring-platform/node_modules/@angular-devkit/schematics/src/engine/engine.js:155:23)
at CollectionImpl.createSchematic (/Users/xyx/Desktop/Git/question-authoring-platform/node_modules/@angular-devkit/schematics/src/engine/collection.js:12:29)
at Object.getSchematic (/Users/xyx/Desktop/Git/question-authoring-platform/node_modules/@angular/cli/utilities/schematics.js:36:23)
at GenerateCommand.getOptions (/Users/xyx/Desktop/Git/question-authoring-platform/node_modules/@angular/cli/models/schematic-command.js:194:40)
at GenerateCommand.<anonymous> (/Users/xyx/Desktop/Git/question-authoring-platform/node_modules/@angular/cli/commands/generate.js:38:53)
at Generator.next (<anonymous>)
at /Users/xyx/Desktop/Git/question-authoring-platform/node_modules/@angular/cli/commands/generate.js:7:71
at new Promise (<anonymous>)
at __awaiter (/Users/xyx/Desktop/Git/question-authoring-platform/node_modules/@angular/cli/commands/generate.js:3:12)
at GenerateCommand.initialize (/Users/xyx/Desktop/Git/question-authoring-platform/node_modules/@angular/cli/commands/generate.js:30:16)
Run Code Online (Sandbox Code Playgroud)
即使我尝试了其他命令myTable和matNavbar
ng generate @angular/material:materialNavbar --name matNavbar
ng generate @angular/material:materialTable --name myTable
Run Code Online (Sandbox Code Playgroud)
上述两个命令发生了同样的错误.我错过了什么吗?
我试图在我的演示中将动态高度设置为元素.我会告诉你问题我在我的演示中采用静态或恒定的高度值.我取250px常数值
#wrapper{
background-image: url(https://dl.dropboxusercontent.com/s/nz1fzunlqzzz7uo/login_bg.png?dl=0);
min-height: 250px;
background-repeat: no-repeat;
}
Run Code Online (Sandbox Code Playgroud)
但是我需要动态添加这个高度.我从中获得了高度
$scope.hgt =$window.innerHeight/3;
alert($scope.hgt)
Run Code Online (Sandbox Code Playgroud)
但我需要动态地将$ scope.hgt设置为 min-height到#wrapper div吗?.我不想取div高度的静态值.我想动态添加.
这是我的代码 http://codepen.io/anon/pen/bdgawo
同样的事情,我需要在角度我们在jquery做什么
$('#wrapper').css('height': $window.innerHeight / 3)
Run Code Online (Sandbox Code Playgroud) javascript angularjs angularjs-directive angularjs-scope angularjs-ng-repeat
我在将此用户对象发送到我的服务时,尝试将一组用户凭据存储在cookie中 -
this.SetCookie = function (user) {
$cookies.user = user;
}
Run Code Online (Sandbox Code Playgroud)
然而,当我尝试检索此cookie时,我得到的是我没有得到一个对象,只是一个字符串,上面写着"[Object Object]"
我可以将所有用户凭据分别存储在自己的cookie中,因为我知道我可以做到这一点,但它看起来效率很低?这有一个简单的解决方案吗?我发现这个问题的最高结果是与JQuery有关,并不适合我.
我试图弄清楚弹出时如何unit_number进入模态.我对Angular很新,我对什么resolve:和group:正在做什么以及如何在return语句中包含unit_number 有点困惑.
$scope.openTenantModal = function (unit_number) {
var modalInstance = $uibModal.open({
animation: true,
templateUrl: 'views/addtenantmodal.html',
controller: 'AddTenantModalCtrl',
size: 'large',
resolve: {
group: function () {
return $scope.group;
}
}
});
modalInstance.result.then(function () {
}, function () {
});
};
Run Code Online (Sandbox Code Playgroud) javascript modal-dialog angularjs angularjs-scope angular-ui-bootstrap
今天我将angular-ui-bootstrap软件包从1.3升级到2.0,它给我抛出了下面的错误.
错误:[$ compile:ctreq]无法找到指令'uibAccordionHeading'所需的控制器'uibAccordionGroup'! http://errors.angularjs.org/1.5.7/ $ compile/ctreq?p0 = uibAccordionGroup&p1 = uibAccordionHeading
这是受影响的代码部分:
<div>
<uib-accordion>
<uib-accordion-group is-open="true">
<uib-accordion-heading>
{{vm.moduleMenu.name}}<i class="pull-right glyphicon"></i>
</uib-accordion-heading>
<div>... other content...</div>
</uib-accordion-group>
</uib-accordion>
</div>
Run Code Online (Sandbox Code Playgroud)
到目前为止我做了什么来解决这个问题:
以前有人遇到过这个问题吗?
图书馆:
谢谢,
我正在使用socket.io在我的应用程序中启用聊天,我正在使用服务SocketService来执行所有套接字的东西.当消息出现时,我想从服务触发控制器的功能,以SocketService在UI中进行一些更改.所以我想知道如何从服务中访问控制器的功能.示例代码:
.service('SocketService', function ($http,$rootScope,$q) {
this.connect = function(){
var socket = io();
socket.on('connect',function(){
// Call a function named 'someFunction' in controller 'ChatController'
});
}
});
Run Code Online (Sandbox Code Playgroud)
这是服务的示例代码.
现在是控制器的代码
.controller('ChatController',function('SocketService',$scope){
$scope.someFunction = function(){
// Some Code Here
}
});
Run Code Online (Sandbox Code Playgroud) events angularjs angularjs-service angularjs-controller angular-broadcast
我想知道在Angular 1.5中,当你使用组件时,有一种简单的方法来绑定一个属性,它是一个布尔值而不用@转换为字符串.
例如,我有两个组件"app-menu"和"app-menuitem"没有转换."app-menu"只有一个属性,是要创建"app-menuitem"的项目列表.
<app-menu items="menuitems">
Run Code Online (Sandbox Code Playgroud)
在作为json的menuitems中,你有一个名为"isactive"的menuitem属性,它是一个布尔值.
$scope.menuitems = [{ label : 'menuitem 1', isactive : true},{ label : 'menuitem 1', isactive : false}]
Run Code Online (Sandbox Code Playgroud)
在menuitem组件中:
angular.module('app')
.component('appMenuitem', {
transclude: false,
controller: menuitemController,
bindings: {
label: '@',
isactive: '@' //<--- The problem is here because the boolean is converted as string
},
templateUrl: 'angular/components/simple/menuitem/menuitem.html'
});
Run Code Online (Sandbox Code Playgroud)
我不知道最好的方法是确保最终是一个真正的布尔值,而不是一个字符串,这让我有些错误.有人有想法吗?
binding components angularjs angularjs-directive angularjs-components
我使用ng-repeat设置如下导航,效果非常好
<a ui-sref="{{link.Route}}" ng-click="clickLink(link)">
<span class="title"> {{link.Text}} </span><span class="selected"></span>
</a>
Run Code Online (Sandbox Code Playgroud)
但是,我的导航项经常有子链接,这意味着父链接实际上不是导航链接,它只是用于展开和查看子链接.但有时它是一个链接,并没有要显示的子链接.
问题出在那些特殊情况下,当没有可用的状态时,我需要一起删除ui-sref,因为根本不应该有链接.有它在那里抛出'错误:无效状态参考'''
当状态不可用时,如何删除ui-sref?
routing angularjs angularjs-routing angular-ui-router ui-sref
我的ng-view中有一个10(或n)复选框.现在我想问一下,检查复选框是否复选以及选中复选框的值是最有效或最简单的方法.
<ul>
<li ng-repeat="album in albums">
<input type="checkbox" ng-model="folder.Selected" value={{album.name}} />
</li>
</ul>Run Code Online (Sandbox Code Playgroud)
我有ng-controller(getAlbumsCtrl),因为我有一个数组,我想将所有的checkedbox专辑名称推送到albumNameArray
arrays asp.net-mvc-4 angularjs angular-routing angularjs-filter
angularjs ×8
javascript ×4
angular ×1
arrays ×1
binding ×1
components ×1
cookies ×1
events ×1
jquery ×1
json ×1
modal-dialog ×1
object ×1
routing ×1
tooltip ×1
ui-sref ×1