Hot answers tagged

16

We had one site that had 'lost' all it angular pages, eg CiviMail and System Status. In our case the angular cache files were returning 404 on the New Mailing page. (and 'inspector' was showing a lot of red angular errors) It was building the cache files in sites/default/files/civicrm/images, but then searching for them in sites/default/files/civicrm/...


9

I was able to solve this, at least for now, on my WordPress 4.8/Civi 4.7.22 site using this suggestion from Tim Otten: another work-around should be going to "Administer => System Settings => Debugging" and disabling the "Asset Cache" Of course in the long term we'd like to take advantage of the Asset Cache. But for now at least we have our angular-based ...


7

I've been recently digging into Angularjs, as I'm trying to make some customization, and this is what I figured out after a reading loads of blog posts covering the subject. I'm not an angular expert so I don't know how this affects performance. The following script is from an extension using hook_civicrm_angularModules and Angular's $provide service in ...


4

Disclaimer: I'm not an angularjs expert Again this is a bit of a hack, we are intercepting a built-in CiviCRM angular directive and extending to add behaviour. Create a custom extensions or use an existing one and implement hook_civicrm_angularModules: function myextension_civicrm_angularModules(&$angularModules){ $angularModules['myModule'] = ...


3

Here's one answer that fixed my problem (see my comment above). The cause was that when I created the Drupal system I just used the domain name without the www. But Civi was loaded with www. This is an old problem and I'm a bit ashamed to admit I made this mistake again! But if your system has this mismatch then system status won't work. Fix was to ...


3

Cross-origin refers to accessing resources on a different domain. It's curious that URLs you reference are actually different domains -- www.netzwerk-n.org vs netzwerk-n.org. You might want to check which of those appear in (a) the URL bar (b) the Resource URLs (esp under "?" help button) and (c) the outputted HTML documents. As an alternative to "Debug" ...


3

I believe you first need to generate a module, à la civix generate:angular-module. Have you already done that?


3

Found the problem. Debugging was turned on. Once I turned it off "New Mailing" worked.


3

How to check your Angular version Go to the default Angular base page for your site at http://example.org/civicrm/a Open a browser console Evaluate angular.version within the console: Notes about Angular versions 1.x is called "AngularJS" and has documentation at docs.angularjs.org 2.x (onwards) is called "Angular", has significant changes from 1.x, and ...


3

In case of an angular page use something like function myext_civicrm_angularModules(&$angularModule) { [...] $session =& CRM_Core_Session::singleton(); drupal_add_js(array('CurrentCiviUid' => $session->get('userID')), 'setting'); [...] } and access it in JS: var uid = Drupal.settings.CurrentCiviUid;


3

Short answer: add this to the top of your main angular html template: <h1 crm-page-title>{{ts('Hello')}}</h1> More info: Documentation can be found in the crmUi code. This feature is in 4.7+ (although if you use it in 4.6 it won't crash - it just won't look as good). Note the support for setting document title seperately if you wish.


3

I guess this is not the best way to do it and perhaps someone can point you to a better solution. I'll put it as an answer for readability purposes. Edit Create a custom extensions or use an exiting and implement hook_civicrm_pageRun, something like: function myextension_civicrm_pageRun(&$page){ $pageName = $page->getVar('_name'); if ($pageName ...


3

If you're ok with it not being tightly integrated (i.e. automatically available in the xml or to the api), then you can do something like below, which adds a field labelled "Boo" to the case type edit screen. Thanks for asking this question. It's probably helped me more than you, since it's helped clarify for me how this all works. And it occurs to me that ...


2

This will not be happening for 4.7, 4.8, 4.9, 5.x... (NB I realise I may not be adding much to above comments but am trying to get some unanswered questions answered as that is currently the 'weakest' aspect of our Beta civicrm stackexchange according to these [stats][1])


2

I found a solution for this. The developer docs (https://docs.civicrm.org/dev/en/latest/framework/angular/loader/) mention how you could create your own angular page, which is a regular civicrm page but at a different url. Because it is a regular page I could set permissions for that just as I was used to do. See https://docs.civicrm.org/dev/en/latest/...


2

For a Javascript-only solution, you can also make an API call using user_contact_id for the contact ID. For instance: $result = civicrm_api3('Contact', 'get', [ 'sequential' => 1, 'return' => ["id"], 'id' => "user_contact_id", ]);


2

With even version 5 of civicrm it is still using angular 1.5. I checked it on the demo site https://demo.circle-interactive.co.uk/civicrm/a on the console i ran: angular.version, and it returned this :- {full: "1.5.11", major: 1, minor: 5, dot: 11, codeName: "princely-quest"}


2

I had this issue as well and tried all the suggestions above to no avail. Eventually, I found that because I had redirected my site to www.mysite.com instead of mysite.com I was getting this error: "No 'Access-Control-Allow-Origin' header is present on the requested resource." I updated the resource URLs to absolute paths with: https://www.mysite....


2

I just fixed this issue on a site I was working on. Hopefully it helps you as well. My issue was directory permissions. You need to make sure that all of your directories have permissions set to 755. My contribute folder was set to 750, which did not allow the directory structure to be loaded beyond that point. Because of that, it's not able to load the ...


2

It looks like you have a config mismatch between your CMS and your CRM. The tell is in the CORS error in the screenshot you provided. It looks like your site is serving content at https://www.example.org while CiviCRM has specified a base URL of https://example.org. (Note that one URL includes the "www" subdomain while the other does not.) These URLs have ...


2

Afform is still in beta so I expect this functionality to improve further, but currently it does support passing in an id via the url. It keys off the af-entity name property. So if you visit your form and add ?member=123 to the end of the url string it should load contact id 123 as the "Member". In that case it will update instead of creating a ...


2

Another clue: the CiviCRM -> Status page /civicrm/a#/status was completely blank This helped [it's a cache clear of sorts] Administer -> System Settings -> Asset Caching -> Disable brought both Actions as well as the Status page back. Then was able to toggle it back to -> Auto For one project I also had to re-run composer civicrm:publish (some ...


2

Ok, sorted it out with some suggestions and examples. $loader = new \Civi\Angular\AngularLoader(); $loader->setModules(array('trialadmin')); $loader->setPageName('Administration'); $loader->useApp(['activeRoute' => '/trialadmin/trialdetails']); $loader->load(); Worked with this, but I also used the trace and debug in the browser to determine ...


2

Try below code <div crm-ui-field="{name: 'myForm.location_province', title: ts('Province')}"> <input name="myForm.location_province" crm-ui-id="myForm.location_province" crm-entityref="{entity: 'state_province', api: {params: {country_id: 1039, is_active: 1, options:{sort:\'name\'}}}, select: {...


1

At some point I recognized that it's not only the new mailing page that doesn't load when I disable debugging, but also the system status page wouldn't. So I thought, both things might have something in common. And it turned out, that they do, as they both angular pages (I don't really know what that means, but well that seems to connect them). With that ...


1

For some reason, you can't use the ngOptions directive with select2 multi-select elements. You need to manually specify the <option> elements with ngRepeat like this instead: <select crm-ui-select="{allowClear: true}" ng-model="myVar" multiple="multiple" class="big" > <option ng-repeat="option in options" value="{{option.value}}"&...


1

This is my answer pasted from this question We had one site that had 'lost' all it angular pages, eg CiviMail and System Status. In our case the angular cache files were returning 404 on the New Mailing page. (and 'inspector' was showing a lot of red angular errors) It was building the cache files in sites/default/files/civicrm/images, but then searching ...


1

An approach: composer-downloads-plugin civicrm-core now uses the https://github.com/civicrm/composer-downloads-plugin for Javascript and CSS libraries. You can use the same technique in an extension. For example, suppose you have an extension civinfinite with a composer.json file which declares: { "name": "example/civinfinite", "require": { "...


1

At time of writing (circa 4.7.20), the crm-ui-tab-set directive does not support an option to manage the active tab. I think a patch to support that would be welcome. For example, one might update crm-ui-tab-set (in ang/crmUi.js) to support an extra variable active-tab with an interface like this: <div crm-ui-tab-set active-tab="selectedTab"> <...


1

I usually do it in an extension. This allows me to enable/disable changes at will. Create an extension with Civix (eg com.example.myextension). Inside the extension folder create (eg [ext_dir]/com.example.myextension/js/) folder. Create your JS file in there (eg [ext_dir]/com.example.myextension/js/mychanges.js) In the main extension file (eg [ext_dir]/...


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