angular-ui

How to access an array in AngularJS controller populated by $resource get()?

為{幸葍}努か 提交于 2019-12-13 07:05:45
问题 I can not access an array in the AngularJS controller but it works in the view. In the controller: .results returns undefined function TwitterCtrl($scope, $resource){ $scope.twitter = $resource('http://search.twitter.com/:action', {action:'search.json', q:'angularjs', callback:'JSON_CALLBACK'}, {get:{method:'JSONP', params: {rpp: 4}}}); $scope.twitterResult = $scope.twitter.get({q:"example"}); //returns the resource object console.log($scope.twitterResult) //returns undefined console.log(

Masking in AngularJS

若如初见. 提交于 2019-12-13 05:08:50
问题 Is it possible to create a mask in angularJS that looks like this 02years 07months. And when the user clicks on the text box it should change to the following text 0207 Thanks a ton! 回答1: You can use a directive to bind to focus and blur events. http://plnkr.co/sFyfYstSlQpZtLUGbmwh <input type="text" year-month data="foo.bar"></input> app.directive('yearMonth', function() { return { restrict: 'A', scope: { data: '=' }, link: function(scope, element, attr) { var re = /(\d{2})(\d{1,2})()/;

In Angular, directive that compiles template with ui-sortable, run twice with connected lists cannot drag-drop between both lists

谁说胖子不能爱 提交于 2019-12-13 04:36:46
问题 I have a custom Angular directive, which uses ui-sortable in the template. Originally I could not get it to recognize the ui-sortable , but now it works based on How do I include other directives in the template of my customer directive in Angular? Problem now is if I run it twice, and thus have two sortable lists, with the appropriate class on both and connectWith option, I cannot drag and drop from one to the other. <div members list="list1" title="{{title1}}" admin={{admin}}> </div> <div

Setting the group option dynamically not working in ng-grid 2.0.7

霸气de小男生 提交于 2019-12-13 04:22:55
问题 I am creating a simple grid and getting the data from a json for both the columnDefs and the groups. Setting columnDefs works properly, with data: 'gridData' // Where gridData is $scope.gridData. but setting groups : $scope.groupsFieldsFromServer // This is ['fieldname'] is not working, it is just displays the grid as is, but the intended pre-grouping is not happening. Any help? 来源: https://stackoverflow.com/questions/17633955/setting-the-group-option-dynamically-not-working-in-ng-grid-2-0-7

Angular UI Select2 in the Bootstrap Navigation Bar

左心房为你撑大大i 提交于 2019-12-13 02:43:46
问题 Select2 of the Angular-UI in Bootstrap navigation bar is giving error TypeError: Object [[object HTMLInputElement]] has no method 'is' Please refer to the http://plnkr.co/edit/yCG5M9 回答1: You need to load jQuery before AngularJS Just change the order to <script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script> <script src="//ajax.googleapis.com/ajax/libs/angularjs/1.0.3/angular.min.js"></script> EDIT (blesh): This is because if angular doesn't see JQuery as it's

Angular-UI Router - Resolve not waiting for promise to resolve due state switching

故事扮演 提交于 2019-12-13 02:07:08
问题 I know there is already a similar question Angular-UI Router - Resolve not waiting for promise to resolve? but is not exactly like my problem. I have two states: .state('entities', { url: '/', ... resolve: { data: function (xyzService) { return xyzService.listEntities(); } }) .state('entities1', { url: '/entities1', ... resolve: { data: function (xyzService) { return xyzService.listEntities(); } }) And both states require or depends on the same collection of entities, which I return from

ANGULARJS - display title inside h1 on homepage and div tag for the rest of the site

梦想与她 提交于 2019-12-13 02:03:46
问题 For accessibility compliance: How do I display the title of the page inside an <h1> tag on the homepage, while display inside a <div> tag for the rest of the site. I am using angular UI-Router , with the homepage having a state of 'home' . app.js: magApp.config(function($stateProvider, $urlRouterProvider, $locationProvider) { $urlRouterProvider.otherwise("/404"); // Now set up the states $stateProvider .state('page_404', { templateUrl: 'apps/templates/404.html' }) .state('home', { url: '/',

display binary image from db to angular partial view

ⅰ亾dé卋堺 提交于 2019-12-13 01:54:00
问题 I was trying to display image which is coming within the json object returning from an web api request. I'm able to display string, number and date/time in my angular partial but couldn't get the image displaying. here is my json object which contains each field of my topic (model) class <Topic> <Body>dsadfsaadsfds</Body> <Created>2014-06-15T00:00:00</Created> <Flagged>false</Flagged> <Id>1022</Id> <PhotoFile>

Angular ui bootstrap current date (today) highlight without selecting

喜欢而已 提交于 2019-12-13 00:37:05
问题 I am using Angular.UI Bootstrap Datepicker (http://angular-ui.github.io/bootstrap/#/datepicker) Now I am challenging one problem: the client always wants to see current date highlighted, even if it is not selected. Just like in this example (http://angular-ui.github.io/ui-date/). Tried to google this problem, but no solution found for Angular.UI Bootstrap Datepicker. There is no way, to switch to ui-date. Any ideas? Thank you! 回答1: Replace in the datepicker control this var days = getDates

Adding Ajax loader in angular ui bootstrap modal

回眸只為那壹抹淺笑 提交于 2019-12-12 21:41:10
问题 I have ui bootstrap modal to play videos, these videos are taking time to load so i want to show ajax loader until videos get loaded. here is my ng-template and angular js code for modal, I have added ajax loader but i am not getting how to stop its loading. I want to stop its loading when videos are completely loaded. thanks <script type="text/ng-template" id="video_gallery.html"> <div class="modal-content col-md-12" > <div class="modal-header"> <h4 class="modal-title" style="text-align