angularjs-directive

Why this is not loading view1.cshtml in MVC empty web application ANGULAR

人盡茶涼 提交于 2019-12-23 06:12:23
问题 I am learning Angular. I am watching a 2 years old video, and I am trying to use route concept and using in view1.CShtml (Remember, its CShtml and not html, while in the video, he uses html). I also find it wierd that Views path starts as ~Views/View1.cshtml (Fair enough I have it in Views folder) on contrary to Partial/View1 where the video demonstrator has. Now, I do not understand what is this "~" for when I have similar directory structure like demonstrator. Also, sadly, the view1 is not

Fancybox directive in ng-repeat is not grouping images

江枫思渺然 提交于 2019-12-23 06:08:06
问题 I am trying to use Fancybox within my app and while the plugin works (it opens the images in the lightbox), it is not recognizing the rel or data-fancybox-group attribute to group multiple images (so that I can navigate through them right in the lightbox). Here is my directive: app.directive('fancybox', function() { return { restrict: 'A', link: function(scope, element) { $(element).fancybox({ theme : 'dark' }); } }; }); And here is how I invoke it on the template: <figure ng-repeat="img in

angular directive priority

為{幸葍}努か 提交于 2019-12-23 05:16:16
问题 I have this directive that removes a section of divs if ALL of them are empty. (expected to be an image inside) i know that ng-repeat default priority is 1000, and that the higher values gets compiled first, so i sat the priority of the directive to be below that. The directive: myApp.directive('imageContainerRemoval', function() { return { priority: 999, restrict: 'E', link: function postLink (scope, element, attrs) { var watchGroup = attrs.imageContainerRemoval, sectionGotImage = false; //

Angular 7 - How to read service side validations from Object using Template Driven?

十年热恋 提交于 2019-12-23 04:52:52
问题 I am using Angular 7 Template Driven Form validations . I already went thru link: https://jasonwatmore.com/post/2019/06/15/angular-8-template-driven-forms-validation-example, but I did not find any working solution to read Service Side Validation/Error message . Details I took from error in ts file: fieldErrors is having errors for all fields which failed to validate service side validations. handleError(error: any) { if (error instanceof HttpErrorResponse) { if (error.error.fieldErrors) {

How to prevent screen flickering with AngularJs?

流过昼夜 提交于 2019-12-23 04:47:57
问题 I've multiple directives which fetch their data from the database. In one case I have all the directives in one screen. This means that when the screen is loading each dropdown/field is filled one by one: first you see field A being field, then field B get's his value, then field C, etc. etc. I don't want this, I want that all the data is displayed at once. How can I achieve this? Here is one example of a directive. I have about 10 of these directives. app.directive("environmentDropdown", [

AngularJS - Hook into Angular UI Bootstrap - Carousel Custom Next()?

跟風遠走 提交于 2019-12-23 04:17:07
问题 I'm trying to implement a Angular UI Bootstrap carousel, but I'm using it for a Quiz. Therefore, I don't need normal Prev() and Next() buttons. Rather, I need a custom Next() button that makes sure they've selected an answer before continuing on to next "slide" of question/answers. How do I hook into the carousel directive functions to run my code and then use the carousel.next() function? Thanks, Scott 回答1: There is no official possibility to achieve this. but this can be hacked, if you want

Service with promise and $watchCollection not updating the values

ぃ、小莉子 提交于 2019-12-23 04:01:49
问题 I'm trying to build real time service messaging with MongoDB and AngularJS. For some reason, when there is new data in my 'messaging' collection, the Messaging.getAllMessages() service is not triggered and my data is not updated in the view, using $watchCollection. This is in my services.js , the important function is getAllMessages() : angular.module('myApp') .factory('Messaging', function($resource, $http, $q, $rootScope){ var myData = {}; return { sendMessage: function(message, success,

AngularJS Simple Signature Pad Directive (without jQuery)

前提是你 提交于 2019-12-23 03:28:06
问题 With the help of stackoverflow i got me a simple canvas signature directive. The problem is that it works with mouse events (mousedown, mouseup, mousemove) but is not working with touch events (touchstart,touchmove,touchend). I have ngTouch in my main app module and in the module that holds the directive. I hope you can help me. Here's the code: var sig = angular.module('signature', ['ngTouch']); sig.directive("mjav", ['$document', function ($document) { return { restrict: "A", link: function

Post a list of selections in an array to server using ng-model

江枫思渺然 提交于 2019-12-23 03:25:12
问题 I have almost resolved my issue, now just left with sending data to the server. In my scenario, I have a form that has employee details and projects for an employee (can be multiple) Now when the user wants to add projects, he has to click on "Add Projects". This will generate a dropdown on the page with list of projects. This can be any in number. Now when he has selected the projects(say 5) he wil click on submit that will post data to the server. I want all the selections of the

How to call function from another script (AngularJS)

混江龙づ霸主 提交于 2019-12-23 02:47:11
问题 Here is the simplified version of my problem. Let's say that I have loadMe.js script containing simple function which is returning some array. CallMe = function(){ return [1,2,3]; } Is there any possibility in ng to create another script which will load loadMe.js script , than invoke CallMe function from loadMe.js script and return whatever that function is returning, in this case array [1,2,3]. Thank You! 回答1: Make loadMe.js into a module like: var loadMe = angular.module('loadMe',[]);