Hot answers tagged

9

There is a bug in the way that the components and expressions interact. The input field being used by the component is returning a string, and it's not properly coercing the value into the number (or other) type. There are a couple of ways to workaround this, but keep in mind that neither of these examples are doing error checking, type validation, etc.: ...


8

Yes you can definitely develop UI containing angular/jquery in Salesforce. In fact, that is the current trend. Traditional middleware developers like me who recently moved to salesforce realized that you cant really develop UI with good UX using just visualforce and have to pickup jquery/angular skills for their obvious advantages. Here is a very helpful ...


8

I do alot of salesforce angular work. I take it you're using a Router of some sort, be it the built in $router or Ui-Router. Regardless of which one you use, when you're given a choice to include a template via url do this: { templateURL: '/apex/NameOfTemplateVFPage' } In your template partial, make sure to turn the sidebar, headers, and standard ...


7

Karma tests are essentially JavaScript unit tests, so as long as you can get your app.js, controller.js etc files out into a file system you can run those tests manually and from e.g. Jenkins with just something like this: karma start karma.conf.js --single-run --browsers Chrome Karma does use a browser, but is amazingly fast (milliseconds per test) and ...


7

The visualforce parser insists on a few odd things. One of which is that every property has to be something="something". For example, shipment-address="x" will work fine. The x can be a literal x, or frequently I use true. If you're new to VF, it'll also insist on a closing / for the HTML input tag and require


6

ngForce author here. I use Jasmine, and droneIO to run tests both in browser with a static spec runner and via PhantomJs. Our drone job auto-deploys to our testing org when the tests pass. Our static, in org vf page for running the angular unit tests looks a bit like this: <apex:page showHeader="false" sidebar="false" standardStylesheets="false" ...


6

On the Apex marshaling question did you annotate the properties/getters with @AuraEnabled?


5

Now, my question is whether or not this call will function as intended when the app is packaged: Visualforce.remoting.Manager.invokeAction("MyController.myAction",param, function(result) { ....stuff }); When this code is run within an org that has a namespace prefix, no, it will not work --- you would have to prepend the namespace prefix, e.g. ...


5

If you're still interested in creating an Angular 2 app on the Salesforce platform I may have a solution for you. I myself love Angular 2 and everything it brings to the table. My company also works exclusively on Salesforce, so I wanted to figure out a way to marry the two. What I ended up doing was create a boilerplate to make it easier to get started ...


4

I suggest option 4: create REST resources for your apps. I would do one per object, each in their own class. This allows for a nice separation of concerns (keeping your controllers focused on the page), promotes modular design, and makes it easier to test and maintain.


4

Yes //apex global class xGlobal { @RemoteAction global static string doAction1( string JSONData ) { return class1.doAction(JSONData ); } global static string doAction2( string JSONData ) { return class2.doActionElse(JSONData ); } } // component <apex:component controller="iQuoteGlobal"> <script type="text/javascript"&...


4

Tehnrd, Long story short: ng-options validates the Options list it generates against the evaluated scope statement given to it. From your source above, '--choose color--' isn't part of the $color array. While the docs specifically mention using a option element with an nil value for the "nothing selected" element, I've discovered that visualforce strips ...


4

Refer to User Interface Development Considerations trailhead. In a nut shell, if you are doing greenfield development go with Lightning Components route along with Lightning Design system (Salesforce's Responsive CSS framework), as its more aligned with Salesforce's long-term UI strategy. Go with Angualar & Bootstrap if you already invested in them and ...


4

Remember that you are developing a "single page application" meaning that the URL in the browser needs to stay: /apex/NameOfYourSinglePage Angular routing can be then appended to the single page URL as a fragment identifier e.g.: /apex/NameOfYourSinglePage#/Home". So make your URLs relative: <a href="#/home">Home</a> This Salesforce Angular ...


4

If you're only planning on developing Angular in Visualforce, the task is fairly trivial. If you're trying to implement Angular in Lightning, the task is fairly complex. Static Resource Start by going into Setup, Develop, Static Resources. Upload a ZIP file that contains all the Angular code, or if minified to single file, you can just upload the file ...


3

No, assigning these to the global (window) context is the way this is done. The thing to recognize is that any expression in {!...} is evaluated on the server turned into HTML/CSS/JavaScript as the VF page is server-side rendered, then shipped off to the client to become something the browser can use. Your JS controller file should be in a static ...


3

Why yes you can. I'm the author of the ngForce library, which helps you wrap all kinds of data requests in angular promises! More here: http://noeticpenguin.github.io/ngForce/ I've built several large apps using it, and angular on visualforce. Several tricks you can use to. Remember that visualforce is serverside rendered, while angular runs client-side. ...


3

Apex code for saving the chunks of file. ​public static String upload(String folderId, String documentId, String fileName, String base64BlobValue) { if(documentId == '' || documentId == null) { Document document = new Document(Name=fileName, FolderId=folderId, Body=EncodingUtil.Base64Decode(base64BlobValue), IsPublic=true); ...


3

There's probably no open source Ionic or Angular library available for now for hybrid apps specifically for Chatter API. You should look at forceng though. Since Chatter operations are handled by Chatter REST API, it's really all about hitting those endpoints using your Angular/ ionic code using forcetk from your hybrid app. There's another library JSForce ...


3

A workaround for this is to make the index page of the angular app the "default template" for the site. This will enable you to use Angular's routing capabilities.


3

Your HTML in you Angular app is no longer relative to the VF page, so you need to figure out the base path through some trickery. You can do this by creating a simple module in your VF page, in a script tag, which stores the path of your static resource in an angular constant, like so: <script> "use strict"; angular.module('server-data', []) ...


3

First thing need to check is cross-origin-policy. Domain, protocol and port of parent and child window/frame must match. You can check this error in console of chrome browser. Standard salesforce page and custom visualforce page both have different URLs. IF it is n't the issue then try with separate function: function navigate(id) { window.top.location....


3

What I did was define a global path to my static resources by doing this ahead of my javascript include files in the main page. <script>window.RESOURCE_ROOT = "{!URLFOR($Resource.MyAngularApp, '')}";</script> Then I could reference my templates with: templateUrl: RESOURCE_ROOT+"/templates/mytemplate.html" I know globals are bad but in this ...


3

JSON is a protocol that is used for a large variety of purposes, not just for injecting HTML into a page; it's primary purpose is for scripting. As such, it doesn't know about, nor care about, encoding HTML entities. In other words, you're going about this the wrong way. That method will lead only to pain and misery. Instead, you'll want to encode the ...


3

Here are the below things i would do to mitigate any risks Open an office hour with salesforce security team and walk down the design with them to see how they feel it. If you are partner then you can book here Using lightning container essentially you are i-framing or sandboxing your front end code which adds some security. The general security ...


2

You can use apex:composition to create the same front-facing UI code with different controllers; it also allows customizable sections using apex:insert. Also, apex:include lets you literally include one page inside another, which may be all you need. Finally, if all of that seems like overkill, just make an apex:component and include it within both pages ...


2

I recently did some angular work where I had lots of partial templates and didn't want to create a new visualforce page for each of them. Instead I structured my app so that the main (master) view was inside a VF page. Everything else was included in a compressed static resource. -MyAngularApp (static resource) --app ---js ---templates ---lib ---css The ...


2

Working my way through the list - first change is I added a new component, aurang:template, that transforms its body into an Angular inline template and interns it into Angular's $templateCache. I've also adjusted the demo code to use aurang:template (see https://github.com/forcedotcom/aura-ng/blob/master/metadata/aura/regionDemo/regionDemoComponent.cmp). A ...


2

An awkward part, to me, is having the VF component or page specify a VF Controller in its controller attribute just for one or more of the angular services its angular controller uses. It seems like the view (VF component or page) shouldn't have to know about the service layer implementation details. I would hesitate to go global. If you are in a managed ...


2

Add below config headers in your Angualar JS Factory and white-list your VF page instance url in salesforce CORS: Check it out the : http://sarvatsfdc.com/2015/08/07/angularjs-highcharts-wijmotable/ ( Angular JS Controller line # 290 ) myApp.config(['$httpProvider',function ($httpProvider) { var sessionId = "{!$Api.Session_ID}"; $httpProvider.defaults....


Only top voted, non community-wiki answers of a minimum length are eligible