1 Comment

How to using instafeed in magento 2 with requirejs?

How can I set a minimum cart total before applying group price?
Magento 2 - How to customize template attribute of product?

I create module to show instagram photos here my view->frontend :

frontend--/
    |layout--/
    |     cms_index_index.xml
    |     default.xml
    |
    |templates--/
    |     instafeed.phtml
    |
    |web--/
    |     js--/
    |        instafeed.min.js
    |        main.js 
    |
    |requirejs-config.js

requirejs-config.js

var config = {
"paths":
{
    "insta": "Test_Instafeed/js/instafeed.min",
    "instaMain": "Test_Instafeed/js/main",
}};

main.js

    require(["insta"], function(){
        (function ($)
        {
             var feed = new Instafeed({
                get: 'tagged',
                tagName:  'awesome',
                clientId: 'xxxxxxxxxxxxxxx',
                resolution: 'low_resolution',
                limit: '32',
              });
        });
   });
   feed.run();

instafeed.phtml

<h1><?php echo $block->getTitle(); ?></h1>
<hr />
<div id="instafeed"></div>

But I always get error :

Uncaught Error: Mismatched anonymous define() module: function (){return e}
http://requirejs.org/docs/errors.html#mismatch

Uncaught Error: Mismatched anonymous define() module: function ()
{
    feed.run();
}

I’m getting confuse with this, if anybody can help me, I will appreciate 🙂

Related Posts

  • Magento 2 Custom Widget set template data not showing at frontend (3)
    I am working to create custom widget in custom extension. i follow this to create widget in my custom extension.All working fine but data not showing in the template $this->setTemplate('widget/viewed_list.phtml'); Below my code: […]
  • Adding Instafeed on Magento 2 [closed] (0)
    I want to add Instafeed.js on my Magento 2 theme. How to write correct JS? <script type="text/javascript"> var feed = new Instafeed({ get: 'tagged', tagName: 'awesome', clientId: 'YOUR_CLIENT_ID' }); feed.run(); </script>
  • Magento 2: How to debug on Checkout Pages when having KnockOut JS & Web Template (0)
    http://localhost/magento2/checkout/ vendormagentomodule-paypalModelHostedproRequest.php public function setPaymentMethod($paymentMethod) { $this->paymentMethod = $paymentMethod; $requestData = $this->getPaymentData($paymentMethod); echo […]
  • Magento 2: How to debug on Checkout Pages when having KnockOut JS & Web Template (0)
    http://localhost/magento2/checkout/ vendormagentomodule-paypalModelHostedproRequest.php public function setPaymentMethod($paymentMethod) { $this->paymentMethod = $paymentMethod; $requestData = $this->getPaymentData($paymentMethod); echo […]
  • How to navigate between the thumbnails in the photogallery from external link? (0)
    I want to change the active/current picture in the product photo gallery through an external action. So trying to find the proper js to do it I've tried this: require([ 'jquery' ], function ($) { $(window).load(function () { […]
  • Update Const template at Magento 2 Class (2)
    I need to update a template defined in a Constant at Configurable Class(Magento/Swatches/Block/Product/Renderer/Configurable.php). I tried with a Plugin, but how the function which gets the constant is protected, I can't update the Constant correctly. Anyone knows the correct way […]
  • How to load custom JS and dependencies using RequireJS (1)
    I'm struggling to understand where and how to correctly configure RequireJS to load my custom JS and it's dependencies. What I have below is working but I don't think it's set up correctly. My theme requirejs-config.js var config = { paths: { 'myapp': '"js/myapp"', […]
  • Magento2 : Get Url of included JS file in my Custom Module (2)
    I am working in a custom module for admin section and used to add a third party JS file in my layout and saved JS file in magento2appcode[Namespace][Module]viewadminhtmlwebjsJSFILE.js Now, at other part of my custom module in Block section i need to access that file, and need to use […]
  • Magento2 : Get Url of included JS file in my Custom Module (2)
    I am working in a custom module for admin section and used to add a third party JS file in my layout and saved JS file in magento2appcode[Namespace][Module]viewadminhtmlwebjsJSFILE.js Now, at other part of my custom module in Block section i need to access that file, and need to use […]
  • Translate Inline not showing in my magento (0)
    I have enabled translate inline for froetend and backend but it only shows red border but not he path or block of the tempalte and in console the error i am getting is translate_inline.js:49 Uncaught TypeError: this.trigEl.observe is not a functionTranslateInline.initialize @ […]
How can I set a minimum cart total before applying group price?
Magento 2 - How to customize template attribute of product?

1 Comment on this article

  • User November 12, 2016

    Check your folder structure: The requirejs-config.js should be placed in the web folder, not in the frontend folder.

    |web--/
    |     js--/
    |        instafeed.min.js
    |        main.js 
    |     requirejs-config.js
    

    Reply

Add a comment