在測試自定義freeboard外掛的時候,發現設定屬性填空字串或空陣列,
初始化整個儀表版是會錯誤的。有用這個套件的朋友要注意一下。
angular.module('myApp.controllers').config(function ($translateProvider) {
$translateProvider
.useSanitizeValueStrategy('escaped')
.translations('zh_TW', {
TRANSLATION_ID: 'Hello world !!',
TRANSLATION_ID_2: 'Hello world !! {{value}}',
TRANSLATION_ID_3: 'Hello world !! {{value1}},{{value2}}',
});
});
$translate('').then(function(translation) {
//translation為取得的鍵值
});
{{ 'TRANSLATION_ID' | translate }}
{{ 'TRANSLATION_ID_2' | translate:'{"value": 'Ken' }' }}
{
'TRANSLATION_ID_3': 'Hello world !! {{value1}},{{value2}}'
}
{{ 'TRANSLATION_ID_3' | translate: translationData }}
$rootScope.$on('$translateChangeSuccess', function () {
// Language has changed
});
myApp.config(['$translateProvider','$windowProvider',
function($translateProvider,$windowProvider) {
var defaultLanguage = 'zh_TW';//你定義的語系檔名稱
$translateProvider.use(defaultLanguage); }])
$view_data = array();
$view_data['content'] = '另一個view的路徑';
$this->load->view('主view的路徑', $view_data);
http://stackoverflow.com/questions/15096828/load-a-view-inside-another-viewButton menuBtn = (Button)this.findViewById(R.id.topic_3_menu_button);
menuBtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
Log.d(TAG,"點擊功能選單鈕");
openOptionsMenu();
}
});
http://stackoverflow.com/questions/18913635/how-to-trigger-a-menu-button-click-event-through-code-in-android
http-equiv="X-UA-Compatible" content="IE=edge" />
/*新增一個ui.bootstrap.popover*/
angular.module( 'ui.bootstrap.popover' )
.directive( 'popoverHtmlUnsafePopup', function () {
return {
restrict: 'EA',
replace: true,
scope: { title: '@', content: '@', placement: '@', animation: '&', isOpen: '&' },
template: '
'
};
})
.directive( 'popoverHtmlUnsafe', [ '$tooltip', function ( $tooltip ) {
return $tooltip('popoverHtmlUnsafe', 'popover', 'click' );
}]);
tooltip-is-open or popover-is-open attributes. angular.element(document.body).bind('click', function (e) {
logger.debug('body click from ng');
//Find all elements with the popover attribute
var popups = document.querySelectorAll('*[popover]');
if (popups) {
//Go through all of them
for (var i = 0; i < popups.length; i++) {
//The following is the popover DOM elemet
var popup = popups[i];
//The following is the same jQuery lite element
var popupElement = angular.element(popup);
var content;
var arrow;
if (popupElement.next()) {
//The following is the content child in the popovers first sibling
content = popupElement.next()[0].querySelector('.popover-content');
//The following is the arrow child in the popovers first sibling
arrow = popupElement.next()[0].querySelector('.arrow');
}
//If the following condition is met, then the click does not correspond
//to a click on the current popover in the loop or its content.
//So, we can safely remove the current popover's content and set the
//scope property of the popover
if (popup != e.target && e.target != content && e.target != arrow) {
if (popupElement.next().hasClass('popover')) {
//Remove the popover content
popupElement.next().remove();
//Set the scope to reflect this
popupElement.scope().tt_isOpen = false;
}
}
}
}
});
var jsTag = '<' + 'script src="http://localhost:8080/js/libs/offlinemap/google/mapapi.js"' +
' type="text/javascript"><' + '/script>';
document.write(jsTag);
var element = document.createElement("script");
element.src = "js/libs/offlinemap/google/mapapi.js";
element.type = "text/javascript";
document.getElementsByTagName("head")[0].appendChild(element);
| ' + jqPlot.series[seriesIndex]["label"] + ' | |
| x axis: | ' + xAxis + ' |
| y axis: | ' + jqPlot.data[seriesIndex][pointIndex] + ' |
$config['base_url'] = 'http://'.$_SERVER['HTTP_HOST'].'/';
$root = "http://".$_SERVER['HTTP_HOST'];
$root .= str_replace(basename($_SERVER['SCRIPT_NAME']),"",$_SERVER['SCRIPT_NAME']);
$config['base_url'] = "$root";
$('#textareaID').bind('input propertychange', function() {
});
$scope.editUser = function($index, user) {
logger.info('edit user');
var dlg = dialogs.create(
'partials/users/dialog/dialog.updateUserInfo.html',
'DialogUpdateUserInfoCtrl',
user, {}
);
dlg.result.then(function(resultData) {
$scope.users[$index] = resultData; //update users data
}, function() {
});
};
$scope.deleteUser = function($index, user) {
logger.info('delete user');
// console.log(user);
var dlg = dialogs.confirm(
'刪除帳戶',
'你確定要刪除帳戶' + user.U_Email + '嗎?'
);
dlg.result.then(function(resultData) {
//reload user data
});
};
$scope.resetForm = function(formModel) {
logger.debug('resetForm');
console.log(formModel);
$scope.addForm.$setPristine();
angular.copy({}, formModel);
$scope.user.email = '';//解決email input無法清除的問題,email欄位要在通過規則後才會被model綁定
};
<button type="button"
ng-click="resetForm(user)" class="btn btn-default">
<i class="fa fa-refresh"></i> 重設2</button>
isIE6 = $.browser.msie && $.browser.version < 7 && !window.XMLHttpRequest,
isIE6 = navigator.userAgent.match(/msie [6]/i) && !window.XMLHttpRequest,
$.browser.msie by navigator.userAgent.match(/msie [6]/i) around line 615 (and/or replace all $.browser.msieinstances, if any), thanks joofow ... that's it! var runAPI = '';
switch (reportType) {
case 'datastream':
runAPI = 'FUN_A';
break;
case 'avg':
runAPI = 'FUN_B';
break;
case 'max':
runAPI = 'FUN_C';
break;
case 'min':
runAPI = 'FUN_B';
break;
}//end of switch
//conv to real js function !!important
var fnRunAPI = window[runAPI];
.sub-nav li a:hover,.sub-nav li:hover{
color: #000 !important;
/* border-bottom: 2px solid #58616d;*/
/*background是設背景圖,會把icon換掉的,要改backgroupd-color即可*/
/*background:#dfdfdf !important;*/
background-color: #dfdfdf !important;
}
// Recreates old behavior of ng-transclude. Used internally.
.directive('uisTranscludeAppend', function () {
return {
link: function (scope, element, attrs, ctrl, transclude) {
transclude(scope, function (clone) {
element.append(clone);
});
}
};
})
//再focus執行前,加入tabindex屬性
$dropdownMenu.attr('tabindex',-1).fadeIn().focus();
// Get the focused element:
var $focused = $(':focus');
// No jQuery:
var focused = document.activeElement;
// Does the element have focus:
var hasFocus = $('foo').is(':focus');
// No jQuery:
elem === elem.ownerDocument.activeElement;
:focus {
outline: none;
}
.dropdown-menu:before {
position: absolute;
top: -7px;
left: 9px;
display: inline-block;
border-right: 7px solid transparent;
border-bottom: 7px solid #ccc;
border-left: 7px solid transparent;
border-bottom-color: rgba(0, 0, 0, 0.2);
content: '';
}
.dropdown-menu:after {
position: absolute;
top: -6px;
left: 10px;
display: inline-block;
border-right: 6px solid transparent;
border-bottom: 6px solid #ffffff;
border-left: 6px solid transparent;
content: '';
}
效果
$state.go('admin.productlist.uuid',
{
uuid: product.FD_CurrentFilePathHash
});
// Admin page for productlist/:uuid
$stateProvider
.state('admin', {
abstract: true,
template: "",
data: {
authorizedRoles: [USER_ROLES.admin]
}
})
.state('admin.productlist.uuid', {
/*manage user page */
url: '/productlist/:uuid',
views: {
// the main template will be placed here (relatively named)
// replace unnamed view '
' in this state's parent state, 'home'.
'': {
templateUrl: 'partials/global.index.html'
},
//viewname@statusname
// the child views will be defined here (absolutely named)
'header@admin.productlist': {
templateUrl: 'partials/global.header.html',
controller: 'HeaderCtrl'
},
'main_body@admin.productlist': {
templateUrl: 'partials/product_dm/productlist.body.html',
controller: 'ProductListCtrl'
},
// for column two, we'll define a separate controller
'footer@admin.productlist': {
templateUrl: 'partials/global.footer.html'
}
},
data:{
pageTitle: '產品DM'
}
});
<div ng-controller="TabsDemoCtrl">
{{model.selection}}
<tabset>
<tab heading="Justified">
<input ng-model="model.selection">
</tab>
</tabset>
</div>
angular.module('plunker', ['ui.bootstrap']);
var TabsDemoCtrl = function ($scope) {
$scope.tabs = [
{ title:"Dynamic Title 1", content:"Dynamic content 1" },
{ title:"Dynamic Title 2", content:"Dynamic content 2", disabled: true }
];
$scope.model = {selection: ''};
$scope.options = ['a', 'b', 'c', 'd'];
$scope.alertMe = function() {
setTimeout(function() {
alert("You've selected the alert tab!");
});
};
$scope.navType = 'pills';
};
.directive('multimails', function() {
return {
require: 'ngModel',
link: function(scope, elm, attrs, ctrl, ngModel) {
var validator = function(value) {
// console.log('validator: ' + value);
if (value != '' && typeof(value) != 'undefined') {
var splitMailsArr = value.split(';');
// .filter(function(el) {return el.length != 0});
for (var i = 0; i < splitMailsArr.length; i++) {
var currMail = splitMailsArr[i];
// console.log('currMail: ' + currMail);
if (currMail != '') {
if (/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i.test(currMail)) {
ctrl.$setValidity('multimails', true);
// console.log('pass');
} else {
ctrl.$setValidity('multimails', false);
// console.log('no pass');
break;
}
}
}
return value;
}
};
//驗證規則的順序
ctrl.$parsers.unshift(validator);
ctrl.$formatters.unshift(validator);
}
};
})
//列印網頁
function printPage(text){
var text= document;
print(text);
}
class="icon-home" ng-class="{'icon-white': someBooleanValue}">
class="icon-home" ng-class="{icon\-white: someBooleanValue}">
String cmd = "SELECT d FROM Device d WHERE d.agentId IN :agentId";
Query query = entityManager.createQuery(cmd);
query.setParameter("agentId", dealAgentIds);