如果图像存在,我想显示用户图像,如:
<img alt="user_image" src="/images/profile_images/{{result.image}}">
Run Code Online (Sandbox Code Playgroud)
如果用户图像不可用,则应显示默认图像,Like
<img alt="user_image" src="/images/default_user.jpg">
Run Code Online (Sandbox Code Playgroud)
我怎么能通过html页面中的angularjs来做到这一点?
我有一个HTML div,就像
<div id="loader-container" data-ng-controller="LoaderController" ng-show="shouldShow">
Some html design
</div>
Run Code Online (Sandbox Code Playgroud)
在我的控制器
angular.module('core').controller('LoaderController', ['$scope','$location', 'Authentication', '$rootScope',
function($scope,$location, Authentication, $rootScope) {
$scope.shouldShow = true;
}
Run Code Online (Sandbox Code Playgroud)
]);
而现在,我想隐藏另一个控制器的html div,这就是为什么我试图将另一个控制器的$ scope.shouldShow变量设为false.那我怎么做
$scope.shouldShow = false;
Run Code Online (Sandbox Code Playgroud)
从另一个控制器.有可能或任何其他方式.?
我的代码中有一行:
this.someVar = document.querySelectorAll("div[container-type='some-container']")[0];
Run Code Online (Sandbox Code Playgroud)
ESLint检查为此行“使用数组解构”抛出错误。如何解决此错误。
如果我使用此查询:
SELECT clinic.id
FROM clinic
JOIN dentist ON dentist.id = clinic.dentist_id
JOIN user ON user.id = dentist.user_id
WHERE user.status = 'Active'
AND clinic.status = 'Approved'
AND user.role_id = 2
GROUP BY clinic.id;
Run Code Online (Sandbox Code Playgroud)
所以它给了我所有的行
32
35
36
42
44
47
50
Run Code Online (Sandbox Code Playgroud)
错误如果我要获得结果的总数,那么我应用查询:
SELECT count(clinic.id) AS cnt
FROM clinic
JOIN dentist ON dentist.id = clinic.dentist_id
JOIN user ON user.id = dentist.user_id
WHERE user.status = 'Active'
AND clinic.status = 'Approved'
AND user.role_id = 2
GROUP BY clinic.id;
Run Code Online (Sandbox Code Playgroud)
我刚刚将count()应用于id,然后返回
1
1
1
1
1 …Run Code Online (Sandbox Code Playgroud)