我有一个角度基础仪表板应用程序,在应用程序仪表板页面图标中,当我单击特定图标时,图标应该被重定向到带有该图标的菜单痕迹的路由页面。而不是显示图像必须包括字体 - 该部分的图标。
displayImg用于显示图像,displayName用于显示名称
下面的代码与image.now正常工作我必须用font-icon替换。 怎么做。
这是一个工作的plunker代码:
https://plnkr.co/edit/vKekaq7pCAqOpdXXJJYc?p=info
在单击详细信息的示例中,主页图标在菜单中,当您单击产品时,产品图标将在那里,订单意味着订单图标将在那里显示所有图像,这在特定路线下提到。
.state('home.product', {
url: '/product',
views: {
'main@': {
templateUrl: 'product.html',
}
},
data: {
displayName: 'product',
displayImg: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAOEAAADhCAMAAAAJbSJIAAAAdVBMVEVNTU3///9MTExNTUzz8/P8/Pz39/f6+vpERESgoKCoqKhJSUlCQkJGRkY/Pz86Ojqbm5uRkZHv7+9TU1NoaGitra3g4ODCwsLm5ubKysq8vLxaWlrc3NzR0dFycnKFhYWHh4d5eXm0tLRsbGw1NTVYWFiOjo5/6CiKAAATcklEQVR4nN1d62KrrBJV4zWiJra5NclOm57d93/EwyAgICoYSLO//GhtM8osBWaYWQ5B+F//BN2vJAlHDhLNgWPZMREb2fGmO4RZSv/MMvo1P2Df8AMr2WxWdnA5G1kTNQnClP3FDpI0ZSdk7IRMFgl7kaFsMieru9yg6QlZ86YTQJjG7N/0IInZxdlBGmeySBjHoalsYiWbKrLDpm3UTAAhxx1bATSWtQOoyqb9wQI1MbSg77l2T/BJT3sI0EZN6MUBn3OeoXR2P9fnexuOys53USs14RtqLZ7QRdOkXZeojMq6XLfGAB/oorRphtA3wDC5bMs8CoJVtIpQtN3jkzyPQSobqK34GYPh9SuvMD4AiH9GVf51De0BLlEzWKy0zRM8nZsS8FGABGPzftIq7WoMsnsbLL015gDTO8bX4eIAVxhvWb9/pGwm99RFO3vot4vG67e6e34KwAAwvhWtX4CZaPGdP0H8zfGnyqMelwwQ99Uyr7bHkM7rHgB2Fj/zM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t25HmzZQU8ly2z/BTjY5fBtuNmvHayubPwe2v+SiLqry2pYChA/ZB3Reaal6y7QsbBV7NXOZZ9QMxs8MTQF2m81W85vNjlRvGcpGeQVbghjc23k1A/2ZRmNQlm35pimj40qIeU8BxNYP6u2bNz0pG2jPtOmiffy8vXebdozOjH2WewJg2XQ7ZpqMDgM1pV3Jlo1B6TbC7s/jtm2e14aH3/fVoulZNWVe27IxqMjuP1mR7qF3Msdri3J5iyzLpnWy0q5kD3VRIW5A01ca92ua1wY7NbPy7Y6eoGrxXQBkG8HVuo3gpnhtUIKf19t3CFC0+M4AwufwXqtb9U7w2iLYaEg2P/MAx5pWZEVe24zSdv5SePkkFlJn8RVeW5lXZPi5ubeqrJzldtvKccN3rB9a/D7vXkfF0bJpG9lg8Zkm/aRdB+LuDhpeW1lHu3RB0+aygXLmrNJW/SSFAYkqtsMK2pGl6A5RgGQ/7NDLvdXz2jwNhOuNbfPQ7Mk3x4bsWYqdz9uJeR5+moZgvchr89bKZYNQGZUNe+Gq+B/+C6HNMVnQtJWaMq/NE0AigtfJ6J3FOrP08I3Ou1jMu3sCmEq7kjkeg4MwK39Jzomfb9y0wGvz1Ioq+9jMaK+mxGvzATBVZJ8NkFt8pgjPJfa7mYtO3ojsUCSRRZzJGqvJRQLlzEw54BNtNmxlVFajNJddcLklTfdbKnZ5fGYds/kDAxE2pRjJJvayVmoSi89b6Q/CsYNlso4vZ9X0/wF/1HNTwlwRSwAAAABJRU5ErkJggg=='
}
})
.state('home.order', {
url: '/order',
views: {
'main@': {
templateUrl: 'order.html',
}
},
data: {
displayName: 'ordericon',
displayImg: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMwAAADMCAMAAAAI/LzAAAAAgVBMVEX///8AAADy8vL8/Pz5+fn19fXGxsbm5ubs7OzW1tbBwcHe3t46Ojq2trbp6elcXFwnJyfMzMxJSUmKiopVVVXi4uIwMDAWFhZ0dHSenp6urq5nZ2eUlJRQUFC0tLRhYWEeHh6RkZFERER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ksMM6sbDkIY1Rstv5Ap1CYCMbIZiU/AVKSvgDGKORLbe66ba13KA0BWTmGNITdH0yfHYbpXLJIcziUfDkRP3pDg9a80by4owzQ2WNYvSqSEk8fxpCfkSdN+0qSTNdbxftsJCu1L8NhCSN+1O4NzubVSVhfeEaveuc/blKGtfBGxC+vW35WWZqnmtITluuXEgQCapKbhGmHa63vGzGCBppVeTbOC0JzlJoHIP9Glsg1wN2htYugL6YEKi5OcFw47SXQ/fiPsAg3073PR3BCOkzKAoX3il94yarg1j+cDyRV3cEHTSC01JBRp7vuSQjZFpOd5C8y6Xc07DSSEgOuY33z9q+Vd0RKA66S6/vx4ar8PYcaTBz09twjeAy0BSKr3YvGsXGsIG2IyA7xl0C7Qs22a/Uhi8vsO2ww03oq9HOBdlu+zGi8VvuczLj1cEFpsGr7TvesYAdIX/iqMtcsMeIPvX2OqhXeohQO8Y/gbRoA5pW+HbDP5Enne4HRrMGp8MJdWv/MiewEsHy92jMLjp13Nt0Zc0GdCizzR9dhdECd4V8k2Hv8zSh+JbOFSdmiIu7mrsOe49Cxf7pH7Q4cC1e38AKdK23XFLHghxIxGl23ZG8oQu2fCLQr8hYlDwErzOi1VTI+12085Hx4Glf4a4oWwi5Xhnjslj3tcLv3+TaNMCv48bHxN1ujj7SXxt5ybfrmco6+bHrrA8QrxW5i+sTw+dp4X/HhdU2O/1oCYecKWRsAqin5EGbsk/fqGecX7VEQ4DPGOEQXE122b+ADu/VzwTol00tSRW8L6L2j+Vhh2gHZ5/cR5gBcM6WKOdjQCln9OvzTDz19oee0b0/kQN9l1RDo5Yl2S979lwkjDNJzJtdSId86y7EoXI/sPTGPJ0nkNVu0AAAAASUVORK5CYII='
}
})
这是面包屑库用于动态菜单
Breadcrumb js:
/**
* uiBreadcrumbs automatic breadcrumbs directive for AngularJS & Angular ui-router.
*
* https://github.com/michaelbromley/angularUtils/tree/master/src/directives/uiBreadcrumbs
*
* Copyright 2014 Michael Bromley <michael@michaelbromley.co.uk>
*/
(function() {
/**
* Config
*/
var moduleName = 'ngBreadCrumb';
var templateUrl = 'ngBreadCrumbTemplate.html';
/**
* Module
*/
var module;
try {
module = angular.module(moduleName);
} catch(err) {
// named module does not exist, so create one
module = angular.module(moduleName, ['ui.router']);
}
module.directive('uiBreadcrumbs', ['$interpolate', '$state', function($interpolate, $state) {
return {
restrict: 'E',
templateUrl: function(elem, attrs) {
return attrs.templateUrl || templateUrl;
},
scope: {
displaynameProperty: '@',
displayimgProperty:'@',
abstractProxyProperty: '@?'
},
link: function(scope) {
scope.breadcrumbs = [];
if ($state.$current.name !== '') {
updateBreadcrumbsArray();
}
scope.$on('$stateChangeSuccess', function() {
updateBreadcrumbsArray();
});
/**
* Start with the current state and traverse up the path to build the
* array of breadcrumbs that can be used in an ng-repeat in the template.
*/
function updateBreadcrumbsArray() {
var workingState;
var displayName;
var displayImg = 'http://www.freeiconspng.com/uploads/home-icon-png-home-icon-31.png'; //Sampriya
var breadcrumbs = [];
var currentState = $state.$current;
while(currentState && currentState.name !== '') {
workingState = getWorkingState(currentState);
if (workingState) {
displayName = getDisplayName(workingState);
displayImg = getDisplayImg(workingState);//Sampriya
if (displayName !== false && !stateAlreadyInBreadcrumbs(workingState, breadcrumbs)) {
if (displayImg !== false) {
breadcrumbs.push({
displayName: displayName,
displayImg: displayImg,
route: workingState.name
});
}
else {
breadcrumbs.push({
displayName: displayName,
route: workingState.name
});
}
}
//Sampriya
//if (displayImg !== false && !stateAlreadyInBreadcrumbs(workingState, breadcrumbs)) {
// breadcrumbs.push({
// displayImg: displayImg,
// route: workingState.name
// });
//}
//=====
}
currentState = currentState.parent;
}
breadcrumbs.reverse();
scope.breadcrumbs = breadcrumbs;
}
/**
* Get the state to put in the breadcrumbs array, taking into account that if the current state is abstract,
* we need to either substitute it with the state named in the `scope.abstractProxyProperty` property, or
* set it to `false` which means this breadcrumb level will be skipped entirely.
* @param currentState
* @returns {*}
*/
function getWorkingState(currentState) {
var proxyStateName;
var workingState = currentState;
if (currentState.abstract === true) {
if (typeof scope.abstractProxyProperty !== 'undefined') {
proxyStateName = getObjectValue(scope.abstractProxyProperty, currentState);
if (proxyStateName) {
workingState = $state.get(proxyStateName);
} else {
workingState = false;
}
} else {
workingState = false;
}
}
return workingState;
}
/**
* Resolve the displayName of the specified state. Take the property specified by the `displayname-property`
* attribute and look up the corresponding property on the state's config object. The specified string can be interpolated against any resolved
* properties on the state config object, by using the usual {{ }} syntax.
* @param currentState
* @returns {*}
*/
function getDisplayName(currentState) {
var interpolationContext;
var propertyReference;
var displayName;
if (!scope.displaynameProperty) {
// if the displayname-property attribute was not specified, default to the state's name
return currentState.name;
}
propertyReference = getObjectValue(scope.displaynameProperty, currentState);
if (propertyReference === false) {
return false;
} else if (typeof propertyReference === 'undefined') {
return currentState.name;
} else {
// use the $interpolate service to handle any bindings in the propertyReference string.
interpolationContext = (typeof currentState.locals !== 'undefined') ? currentState.locals.globals : currentState;
displayName = $interpolate(propertyReference)(interpolationContext);
return displayName;
}
}
//Sampriya
/**
* Resolve the displayImg of the specified state. Take the property specified by the `displayimg-property`
* attribute and look up the corresponding property on the state's config object. The specified string can be interpolated against any resolved
* properties on the state config object, by using the usual {{ }} syntax.
* @param currentState
* @returns {*}
*/
function getDisplayImg(currentState) {
var interpolationContext;
var propertyReference;
var displayImg;
if (!scope.displayimgProperty) {
// if the displayimg-property attribute was not specified, default to the state's name
return currentState.name;
}
propertyReference = getObjectValue(scope.displayimgProperty, currentState);
if (propertyReference === false) {
return false;
} else if (typeof propertyReference === 'undefined') {
return currentState.name;
} else {
// use the $interpolate service to handle any bindings in the propertyReference string.
interpolationContext = (typeof currentState.locals !== 'undefined') ? currentState.locals.globals : currentState;
displayImg = $interpolate(propertyReference)(interpolationContext);
return displayImg;
}
}
//=======
/**
* Given a string of the type 'object.property.property', traverse the given context (eg the current $state object) and return the
* value found at that path.
*
* @param objectPath
* @param context
* @returns {*}
*/
function getObjectValue(objectPath, context) {
var i;
var propertyArray = objectPath.split('.');
var propertyReference = context;
for (i = 0; i < propertyArray.length; i ++) {
if (angular.isDefined(propertyReference[propertyArray[i]])) {
propertyReference = propertyReference[propertyArray[i]];
} else {
// if the specified property was not found, default to the state's name
return undefined;
}
}
return propertyReference;
}
/**
* Check whether the current `state` has already appeared in the current breadcrumbs array. This check is necessary
* when using abstract states that might specify a proxy that is already there in the breadcrumbs.
* @param state
* @param breadcrumbs
* @returns {boolean}
*/
function stateAlreadyInBreadcrumbs(state, breadcrumbs) {
var i;
var alreadyUsed = false;
for(i = 0; i < breadcrumbs.length; i++) {
if (breadcrumbs[i].route === state.name) {
alreadyUsed = true;
}
}
return alreadyUsed;
}
}
};
}]);
})();
在状态路由器下有数据部分添加了图像和显示名称 对于特定图标,请单击。
面包屑模板:
<ol class="breadcrumb">
<li ng-repeat="crumb in breadcrumbs">
<!--ng-class="{ active: $last }"--><a ui-sref="{{ crumb.route }}" ng-if="!$last"><img ng-src="{{ crumb.displayImg }}" class="responsiveBCrumb" alt="" />{{crumb.displayName}}</a><span ng-show="$last"><img ng-src="{{ crumb.displayImg }}" class="responsiveBCrumb" alt="" />{{crumb.displayName}}</span>
</li>
</ol>
每个模板都会为动态菜单添加
product.html
<h1>Product</h1>
<div class="note_panel note_panel_yellow">
<div class="note_body note_panel_solid_border">
<h4>Product Page</h4>
<p>Sample Angular Breadcrumb</p>
</div>
</div>