Synthesis of metal-polymer nanocomposites