its2lz | 22 Aug 05:41 2014
Picon

How to read data from EXCEL file using Jasmine (Protractor framework)

We are new to Protractor and Jasmine.  We are trying to automate E2E testing of Angular application using Protractor and Jasmine. As part of the test data input we would like the script to read the data from an excel file (*.xls, *.xlsx). But I am unable to find any reference to this information. I really appreciate if anyone can give the exact approach to read data from excel as an input to the automation script.

Cheers

Please note : Only reason I am posting a standard snippet is bcoz we are actually trying to get the input as excel for this specific script (as our learning curve). Appreciate all the help. Thank you.

Sample Code:

describe('Test Calculator', function() { var firstNumber = element(by.model('first')); var secondNumber = element(by.model('second')); var goButton = element(by.id('gobutton')); function ReadDataFromExcel() { // Code to read first number & second number from Excel; }; it('Testcase 1', function() { browser.get('http://juliemr.github.io/protractor-demo/'); // ReadDataFromExcel() // for each record in EXCEL; perform below operation; // { firstNumber.sendKeys(a); secondNumber.sendKeys(b); goButton.click(); // Always perform '+' operation // } }); });

--
You received this message because you are subscribed to the Google Groups "AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email to angular+unsubscribe <at> googlegroups.com.
To post to this group, send email to angular <at> googlegroups.com.
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.
Nasir Mansoor Usmani | 22 Aug 04:33 2014
Picon

AngularJS - Generating dynamic image map

I am getting image map from the server and trying to display contents using ng-bind-html. while rendering AngularJS removes name attribute from map tag. Therefore user clicks are not affective in map.

<body ng-app="imgMapExample"> <div ng-controller="ExController"> <p ng-bind-html="ImgData"></p> </div> </body> angular.module('imgMapExample', ['ngSanitize']) .controller('ExController', ['$scope', function($scope) { var imgPath = "http://www.w3schools.com/tags/"; var imgPlanet = imgPath + "planets.gif"; var imgSun = imgPath + "sun.htm"; var imgvenus = imgPath + "venus.htm"; var imgmercur = imgPath + "mercur.htm"; var ImgTag = '<img src="' + imgPlanet + '" width="145" height="126" alt="Planets" usemap="#planetmap" />'; var imgMap = '<map name="planetmap"> <area shape="rect" coords="0,0,82,126" alt="Sun" href="' + imgSun + '"> <area shape="circle" coords="90,58,3" alt="Mercury" href="' + imgmercur + '"> <area shape="circle" coords="124,58,8" alt="Venus" href="' + imgvenus + '"> </map>'; var imgMapTest = '<map name="planetmap"></map>'; $scope.ImgData = ImgTag + imgMap; }]);

--
You received this message because you are subscribed to the Google Groups "AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email to angular+unsubscribe <at> googlegroups.com.
To post to this group, send email to angular <at> googlegroups.com.
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.
Manoj | 22 Aug 04:21 2014
Picon

can i use protractor in non-Angular js applications for functiona testing???

can i use protractor in non-Angular js applications for functiona testing???

Michael Giambalvo | 22 Aug 01:39 2014
Picon

Breaking apart controllers with helper controllers

Back at ngConf, Rachel Dale gave a talk on organizing large angular applications, in which she mentioned her team likes to use "Helper Controllers" in addition to services.  https://www.youtube.com/watch?v=62RvRQuMVyg#t=1271

I'm wondering what the general opinion on this technique is?  I have a couple big controllers in my app that I'd like to break into smaller units, and I'm trying to figure out how to organize and have them communicate with each other.  Having one controller instantiate another seems like it would solve a few of my problems, but I wonder what other problems it would create.  

--
You received this message because you are subscribed to the Google Groups "AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email to angular+unsubscribe <at> googlegroups.com.
To post to this group, send email to angular <at> googlegroups.com.
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.
Michael Krzenski | 21 Aug 21:03 2014
Picon

Re: When inside a transclusion, using replaceWith in a directive compile function doesn't work.

This issue still persists in Angular 1.2.22 so opened another issue for it here:
https://github.com/angular/angular.js/issues/8710


On Thursday, September 13, 2012 3:55:54 PM UTC-4, passelin wrote:
I'm using AngularJS 1.1.0 and I'm trying to modify the template structure of a directive to take some modifying attributes into consideration and I'm using <elemArg>.replaceWith to do so as I want to replace the original element.

That works fine until I use that directive inside another directive that uses ng-transclude. I suspect there's an issue related to the cloning done by the transclusion but I may also be doing something wrong. 

Here's a fiddle to illustrate the problem: http://jsfiddle.net/passelin/Qt9Ey/

Thanks


--
You received this message because you are subscribed to the Google Groups "AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email to angular+unsubscribe <at> googlegroups.com.
To post to this group, send email to angular <at> googlegroups.com.
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.
kiran francis | 21 Aug 14:08 2014
Picon

AngularJs app is not working on my localhost

Hi,

We need to run existing angular project in our local server. We are using Karma, Grunt, Bower, Yeoman & sass. So When we build the project using with "grunt watch" command ,it showing a warning message like this

http://screencast.com/t/ismAakhzkP

But our client said just compile the app using the following commands

npm install
bower install
bundle install

then use "grunt watch" command


So can you please look into this issue and help me to resolve it, it would be higly appreciated.

Thank You.
KF

--
You received this message because you are subscribed to the Google Groups "AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email to angular+unsubscribe <at> googlegroups.com.
To post to this group, send email to angular <at> googlegroups.com.
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.
brajzore | 21 Aug 12:00 2014
Picon

Execute http post request before directive

I have a post request in angularjs that get's a string pattern from my backend:

var tabledata = ""; $http.post("lib/action.php", {monsters: $scope.getMonsters}).success(function(data) { tabledata = data; //Assign the pattern }).error(function(data) { console.log("error"); });


The thing I want to accomplish is that I want my directive to execute AFTER that the post request has been completed, because now when I run my application, the tabledata is just an empty string, and therefor, my makeTableFrom function is returning an empty result.

Here is my directive:



gameApp.directive('mapActivity', function() { return { restrict: 'A', link: function(scope, element, attrs) { scope.$watch('tabledata', function() { angular.element('.click#1').addClass('dotted').html($("<img src='images/dot.png'>")); var j = null; for(var i = 1; i <= 4; i++) { $.ajax({ type: 'GET', url: 'lib/terrain.php', dataType: 'html', data: {i: i}, success: function(data) { var randomRuta = Math.floor((Math.random() * 100) + 1); angular.element('.click#'+randomRuta).addClass('monster').html($("<img src='images/blackdot.png' title='"+data+"'>")); }, error: function(xhr, ajaxOptions, thrownError) { alert(thrownError); } }); j=i; } angular.element('.click').click(function() { if(angular.element(this).hasClass('monster')) { if(confirm('Vill du anfalla monster?')) { alert("Du vann"); angular.element('.click.monster'+j).empty(); angular.element('.click.monster').removeClass('monster'+j); angular.element('.click.dotted').empty(); angular.element('.click.dotted').removeClass('dotted'); angular.element(this).addClass('dotted'); angular.element('.click.dotted').html($('<img src="images/dot.png">')); } } else { angular.element('.click.dotted').empty(); angular.element('.click.dotted').removeClass('dotted'); if(!angular.element(this).hasClass('dotted')) { angular.element(this).addClass('dotted'); angular.element(this).html($('<img src="images/dot.png">')); } } }); }); } }; });

 
 

--
You received this message because you are subscribed to the Google Groups "AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email to angular+unsubscribe <at> googlegroups.com.
To post to this group, send email to angular <at> googlegroups.com.
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.
kyma | 21 Aug 11:24 2014
Picon

Managing resource data

What is the correct way to add utility methods to a resource?
Say if I want to perform lodash style groups, plucks etc. and I don't want that code to be in my controllers. Should I just add these to the prototype of the resource or is there a framework way to do this?

--
You received this message because you are subscribed to the Google Groups "AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email to angular+unsubscribe <at> googlegroups.com.
To post to this group, send email to angular <at> googlegroups.com.
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.
kishorekumaru | 21 Aug 05:25 2014
Picon

ng-binding class blocking ng-leave animation

After couple of hours investigating my code I got to know that ng-binding class blocking ng-leave.

Here is my code looks like 

I have created two views in one view I have dynamic a href link and other one i have defined href link

Sample1.html - where my dynamic a-tag href code

<div class="pages">
<div>The Total Posts </div> 
<div ng-repeat="post in postData">
<div><h1><a href="{{ post.url }}">{{ post.title }}</a></h1><br/><p><div>{{ post.content }}></div></p></div>
   
    <hr>
</div>  
</div>  


Sample2.html - where my fixed  a-tag href code

<div class="pages">
<div>Its a single Page </div> 
<div ng-repeat="page in contents">
<h2>{{page.title}}</h2>
<div>{{ post.content }}></div>
</div>

<a href="/">Back</a>
</div>


I have a class function assigned for my ng-include 

<div class="page-about" ng-include="contentUrl"></div>

below is my page-about style class

page-about.ng-leave        {
-webkit-transform-origin: 0% 0%;
    -webkit-animation: rotateFall 1s both ease-in;
    -moz-transform-origin: 0% 0%;
    -moz-animation: rotateFall 1s both ease-in;
    transform-origin: 0% 0%;
    animation: rotateFall 1s both ease-in;
}
.page-about.ng-enter        {  
-webkit-animation:scaleUp 0.5s both ease-in;
    -moz-animation:scaleUp 0.5s both ease-in;
    animation:scaleUp 0.5s both ease-in;   
       }

I have an issue when ng-leave animation is not performing when I click the dynamic a href click in Sample1.html, but its working when i click a href in Sample2.html. I believe angular is assigning ng-binding class for the a href binding variable, but I am not sure. can anyone provide me a solution

Thanks in Advance.

KK

--
You received this message because you are subscribed to the Google Groups "AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email to angular+unsubscribe <at> googlegroups.com.
To post to this group, send email to angular <at> googlegroups.com.
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.
Anubha Garg | 20 Aug 21:48 2014
Picon

Send XML Request to a server on an outside domain using angularJS

Hi,


I am working on an application which needs to send a 'post' request to a server residing on a separate domain. The request and response data are of type XML. I tried using $http and $http.post methods, but it did not work. I get the following error message:

"XMLHttpRequest cannot load "myUrl". No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:1337' is therefore not allowed access. "

After searching online and asking on the chatroom I came to know that these methods can only be used for JSON data.

My Code currently looks like this :

App.js:
-------------

angular.module('SmartZone', SmartZone.ModuleRegistry).
config(function ($provide, $stateProvider, $urlRouterProvider, $httpProvider) {
/*------------------Other Code ----------------------------------------*/
        //Allow http requests outside the domain
        $httpProvider.defaults.useXDomain = true;
        delete $httpProvider.defaults.headers.common['X-Requested-With'];
})


Widget Controller:
----------------------------

controller('Controller', ['$scope', 'dataManager', '$http', function($scope, dataManager, $http){
/*------------------------------- Other Code -------------------------------------*/
        $scope.url = "myUrl";
        $scope.data = '<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:sch="********************************************">'+
            '<soapenv:Header>'+
            '<sch:SmartNoteAuthentication>'+
            '<sch:User>***********</sch:User>'+
            '<sch:Password>*********</sch:Password>'+
            '</sch:SmartNoteAuthentication>'+
            '</soapenv:Header>'+
            '<soapenv:Body>'+
            '<sch:SmartNoteRequest>'+
            '<sch:PatientNote>Headache & neck pain</sch:PatientNote>'+
            '<sch:PatientDemographicInfo>'+
            '<sch:AgeRange><sch:Code>8</sch:Code><sch:Name>Adult</sch:Name></sch:AgeRange>'+
            '<sch:Gender><sch:Code>m</sch:Code><sch:Name>Male</sch:Name></sch:Gender>'+
            '</sch:PatientDemographicInfo>'+
            '<sch:ProcessType>NLP_And_DiffDiag</sch:ProcessType>'+
            '</sch:SmartNoteRequest>'+
            '</soapenv:Body>'+
            '</soapenv:Envelope>';
        alert($scope.url);
        alert($scope.data);
        $scope.config = "{ 'Content-Type': 'text/xml', 'Access-Control-Allow-Origin' : '*', 'Access-Control-Allow-Methods' : 'GET,POST', 'Access-Control-Allow-Headers' : 'Content-Type' }";
        alert($scope.config);
        $http({
            method: 'POST',
            url: $scope.url,
            data: $scope.data,
            headers: $scope.config
        })
            .success(function(data) {
                alert("http request was successful");
                alert("data is : "+data);
                alert("status is : "+status);
            })
            .error(function(data, status) {
                alert("http request failed");
                alert("data is : "+data);
                alert("status is : "+status);
            });
    }])


 Can you tell me how I can achieve the above task? Kindly let me know if I need to provide any further information to help resolve this.

Thanks,
Anubha Garg

--
You received this message because you are subscribed to the Google Groups "AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email to angular+unsubscribe <at> googlegroups.com.
To post to this group, send email to angular <at> googlegroups.com.
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.
Inna Bauman | 20 Aug 16:43 2014

Re: $dirty flag being set when form is loaded

I have the same problem but i can't use ng-option because i have also <optgroup> so if any one can help me :)

On Thursday, January 10, 2013 11:39:23 PM UTC+2, Paul Bradford wrote:
Hi all.  I have a typical angular form & control that I am having a problem in that the $dirty flag is being set to true (and the $pristine flag set to false) when the form is populated from the controller during the initial load.  The control that is causing the issue is a Select element (partial html below) that is using the ui-select2 directive form the Angular-UI library.

<select ui-select2  data-ng-required="!model.Waiver" data-ng-model="model.AdvisorId" data-placeholder="Advisor">
                    <option ng-repeat="ao in advisorOptions" value="{{ao.UserId}}">{{ao.LastFirst}}</option>
</select>

If I remove the 'ui-select2' directive, that the flags are $dirty and $pristine flags are properly set.  Anyone else encountered this?  Any suggestions for handling this?


--
You received this message because you are subscribed to the Google Groups "AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email to angular+unsubscribe <at> googlegroups.com.
To post to this group, send email to angular <at> googlegroups.com.
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Gmane